[MonetDB-users] timestamp to serial time
Does anyone have a way of extracting the number of seconds since 1970/01/01 00:00:00 GMT from a timestamp? I have the following stored procedure (aka PSM) is but it doesn't account for DST nor the server's timezone. CREATE FUNCTION sp_convert_timestamp_to_epoch (in_ts timestamp(3)) returns integer return (in_ts - cast('1970/01/01 00:00' as timestamp(3))) / 1000;
On 11-07-2007 13:26:41 -0700, Colin Foss wrote:
Does anyone have a way of extracting the number of seconds since 1970/01/01 00:00:00 GMT from a timestamp?
I have the following stored procedure (aka PSM) is but it doesn't account for DST nor the server's timezone.
CREATE FUNCTION sp_convert_timestamp_to_epoch (in_ts timestamp(3)) returns integer return (in_ts - cast('1970/01/01 00:00' as timestamp(3))) / 1000;
I vaguely recall something that you can just cast the timestamp to an int and you'll get the epoch.
participants (2)
-
Colin Foss
-
Fabian Groffen