[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `date` and timestamp format
From: |
Bob Proulx |
Subject: |
Re: `date` and timestamp format |
Date: |
Sun, 2 Oct 2005 08:26:50 -0600 |
User-agent: |
Mutt/1.5.9i |
Super Pik Master wrote:
> I've been trying to print a timestamp format (I mean seconds from 1 Jan
> 1970) with `date` program from coreutils package.
> There is an option -d but it does not take the numerical timestamp as an
> input.
>
> Is there a chance to enhance the functionality by allowing the above? Or
> add an option like -t to read timestamp and then print it in one of
> allowed formats. It would be very convenient.
Look at the info documentation under "Examples of date" in the "date
invocation" section of the manual.
date +%s
1128263085
date --date 'Sun, 02 Oct 2005 08:25:13 -0600' +%s
1128263113
To convert that number back to human readable time use
date -R -d '1970-01-01 UTC 1128263113 seconds'
Sun, 02 Oct 2005 08:25:13 -0600
Bob