date - Linux local versus UTC time in seconds -


can please explain wrong these 2 syntax getting elapsed time in seconds?

if run both these commands @ same time:

date -u +%s   # - utc - returns e.g. 1303430843.   date +%s     # - local time - mine set pacific time           # - returns e.g. 1303430843 

i same number (e.g. 1303430843) of seconds, no difference, yet expect 25200 seconds - 7 hours difference, if run:

date -u "+%y-%m-%d %h:%m:%s"    # returns:  2011-04-22 00:01:14  date    "+%y-%m-%d %h:%m:%s"    # returns:  2011-04-21 17:01:14 - 7 hours difference 

what catch here?

thank you

from man page:

%s seconds since 1970-01-01 00:00:00 utc

so %s returns time in seconds since specific point in time specified in utc, means not affected timezones @ all.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -