[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in date --date="... sec"
From: |
Bob Proulx |
Subject: |
Re: bug in date --date="... sec" |
Date: |
Mon, 23 Sep 2002 19:03:41 -0600 |
User-agent: |
Mutt/1.4i |
Enke, Michael <address@hidden> [2002-09-23 11:14:48 +0200]:
> I guess I found a bug in date when converting seconds to readable date.
What version of date are you using?
date --version
If you are using an old date command then it is certainly likely.
Here is a snippet from an FAQ.
http://www.gnu.org/software/fileutils/doc/faq/#The%20date%20command%20is%20not%20working%20right.
If you are using date version 2.0 or earlier that is certainly
possible. A large number of bug fixes and improvements went into the
sh-utils-2.0.11 around October 2000. Please install a newer version
of the code.
> I perform the following command:
>
> address@hidden:~ > date && date +%s
> Mon Sep 23 11:04:44 CEST 2002
> 1032771884
>
> So 1032771884 is the number of seconds since 1970-01-01 00:00:00 UTC.
>
> Now I want to convert back from seconds to readable date:
>
> address@hidden:~ > date --date="1970-01-01 1032771884 sec"
> Mon Sep 23 10:04:44 CEST 2002
>
> The output should show: 11:04:44 and not 10:04:44 since seconds
> are always from 00:00:00 UTC
>
> If I call:
>
> address@hidden:~ > date --date="1970-01-01 1032771884 sec UTC"
> Mon Sep 23 12:04:44 CEST 2002
>
> I also don't get 11:04:44
This works for me using 2.0.11. I am in the MDT timezone so I
overrode it with your CEST timezone.
TZ=CEST date
Tue Sep 24 00:59:06 CEST 2002
TZ=CEST date +%s
1032829149
TZ=CEST date -d '1970-01-01 UTC 1032829149 sec'
Tue Sep 24 00:59:09 CEST 2002
Hope that helps.
Bob