-
anyway to get date in UTC seconds then? – Romanzo Criminale Jul 3 '14 at 7:41
-
4
@RomanzoCriminale According to date --help
: %s seconds since 1970-01-01 00:00:00 UTC
. Adding -u
doesn’t give a difference. It would still print based from UTC. This is the reason why you were getting the same values. – konsolebox Jul 3 '14 at 7:49
- 1
Both your answers above are correct. UTC Seconds is the same anywhere in the world, and so is useful for unambigious timestamps. Seconds since 1970 midnight in Sydney could be calculated by taking the difference between that time and UTC zero time (-neg 11 or so hours I suppose), but that number is probably not what you want. – JamesNoonan33 Jul 3 '14 at 7:50
- My problem is i’m trying to compare a date written in a file with python.This date is written in seconds in UTC time. And the bash 'date +%s doesn’t give me the same one. Actually if i’m doing in python time.asctime(time.localtime(date_in_seconds_from_bash)), I get the current time of sydney not UTC. I don’t understand – Romanzo Crimina