diary at Telent Netowrks

create or replace function to_universal_time(timestamp with time zone) returns bigint as #

Fri, 19 Dec 2003 09:50:55 +0000

create or replace function touniversaltime(timestamp with time zone) returns bigint as 
'select cast(extract(epoch from $1) as bigint)+2208988800 ;' language sql;

create or replace function fromuniversaltime(bigint) returns timestamp with time zone as 'select timestamp with time zone ''1970-01-01 GMT'' + cast( ($1-2208988800)||'''' as interval);' language sql;

And while we're on the subject, aren't timezones cool?

:; date --date '1970-01-01'
Thu Jan  1 00:00:00 BST 1970

Yes, for the time between 27th October 1968 and 31st October 1971, the UK's political time was uniformly one hour in advance of what the sun said it should be.

<dan_b> YAY POLITICIANS!

Nuff said.