[clug] Re: Calculating the actual date and time]

Robert Thorsby robert at thorsby.com.au
Thu Mar 15 06:11:13 GMT 2007

On 2007.03.15 16:19 Basil Chupin wrote:
> I also used the URL, epoch_conversion, which Tony
> provided and this really created a big question mark
> about how reliable/accurate this calculation business
> really is.
> By this I mean that using
> 'date --date=' for 1168396306 seconds I get-
> 10 January 2007 13:31:46 EST
> NOTE: not EDT, daylight saving time,
> even though my clock is set to EDT
> but when using the epoch converter I get this-
> 9 January 2007 09:31:46 GMT
> epoch converter gives time as GMT
> but this GMT time cannot be correct - unless
> I have missed something (never been good
> when dealing with time zones).

On my reading of date's info page it appears that all calculations 
relative to the epoch are in UTC (which makes sense) and that the 
output to stdout is in whatever format (a) is requested through the 
"+%..." formatting arguments, or in default (b) whatever your system 
clock is set to deliver.

You can play around with the date command by trying:

date -d "1970-01-01 00:00:00 UTC + 1168396306 seconds"

and then adding your formatting arguments. Also, try deleting the "UTC" 
and see what happens -- as you predicated the difference is 10 hours, 
not 11. Indeed, if you add the -R switch (for FRC[2]822 conformity) you 
will get results with and without "UTC" that cannot both be correct.

BTW, I thought that timezone acronyms ignored daylight saving -- that 
is, according to the date command we are EST and not EDST (or whatever) 
even though we are currently +1100. Is that why RFC822 dropped timezone 
acronyms in favour of numbers for email timestamping?

Basil Chupin -- Bureau of Census & Stats -- Sydney Office -- late 
60s/early 70s??? If so, g'day: if not, g'day anyway.

Robert Thorsby

More information about the linux mailing list