[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems with date command
From: |
Paul Eggert |
Subject: |
Re: problems with date command |
Date: |
Sun, 25 Jul 2004 21:44:07 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Alaw Guo <address@hidden> writes:
> When I give the command:
>
> date --date="1/1/1970 00:00:`date +"%s"`"
>
> Shouldn't this give me the current time?
The +%s format counts UTC seconds, but you are asking "date" to print
local times. This may help to explain the other results that you got.
> instead, on a RedHat 9 and a Fedora Core 1 system I get:
>
> address@hidden bin]# date ; date --date="1/1/1970 00:00:`date +"%s"`"
> Sun Jul 25 12:49:32 PDT 2004
> Sun Jul 25 20:49:32 PDT 2004
Yes, that looks right for Pacific time (8 hours behind UTC on
1970-01-01). Although I should mention that that particular syntax
isn't documented and so it isn't really supported....
> and on a Fedora Core 2 system I get:
>
> address@hidden cgi-bin]# date ; date --date="1/1/1970 00:00:`date +"%s"`"
> Sun Jul 25 12:50:44 PDT 2004
> Thu Jan 1 00:00:59 PST 1970
I can't reproduce this behavior on my host (Debian GNU/Linux 3.0r1,
coreutils 5.2.1, TZ=America/Los_Angeles).