bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Something strange with "date +%s" and timezones


From: Stan Marsh
Subject: Something strange with "date +%s" and timezones
Date: Thu, 27 Nov 2008 16:28:25 -0700

I am in MST (US Mountain Time).  My shell is csh.

Observe:

 % date --ver
date (GNU coreutils) 6.10
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
 % date +%s ; sh -c 'TZ=GMT0 date +%s'
1227827980
1227827980
 % date -d '1/1/1970' +%s ; sh -c 'TZ=GMT0 date -d '1/1/1970' +%s'
25200
0
 %

Note that if I don't specify a date, then %s gives the same result for
either timezone.  But if I do specify a date, then the result differs
(in the expected way) between the two invocations.

It seems to me that it should either return the same thing or not return the
same thing, consistently.  In general with date, it shouldn't matter whether
or not you use "-d".

What say you?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]