Date bug?

Nils Kassube kassube at gmx.net
Sat Oct 12 19:07:26 UTC 2013


Johnny Rosenberg wrote:
> $ date -d @0 +%s
> 0
> $
> 
> Correct. ”%c” means, according to the man pages, ”seconds since
> 1970-01-01 00:00:00 UTC”.
> 
> Now:
> $ date -d @0 +'%F %T'
> 1970-01-01 01:00:00
> $
> 
> Is this correct? Is ”1970-01-01 01:00:00” the same as ”1970-01-01
> 00:00:00 UTC”?
> 
> Is my locale settings involved somehow? I live in Sweden which is
> UTC+01:00, and we have summer time (DST) right now. My guess is that
> what I see in my examples above is the UTC+01:00 thing.

Why don't you try "date -d @0"? Then you would see that the output is in 
CET which would be the correct time for your time zone at the given 
date. If you need UTC, you could add the -u option.


Nils





More information about the ubuntu-users mailing list