varchar::timezone conversion

From: "Marc Mamin" <M(dot)Mamin(at)intershop(dot)de>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: varchar::timezone conversion
Date: 2008-09-22 10:55:24
Message-ID: CA896D7906BF224F8A6D74A1B7E54AB3039E8B85@JENMAIL01.ad.intershop.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hi,

I'm facing an issue, where I build time stamps from a set of strings.

In this non working example, I'm looking for a way to cast my strings
to the expected format 'timestamp' and timezone...

CREATE OR REPLACE FUNCTION "public"."timestamp_to_utcms"
(varchar,varchar) RETURNS int8 AS
$body$
SELECT EXTRACT(EPOCH FROM $1 AT TIME ZONE $2)::int8*1000;
$body$
LANGUAGE 'sql' IMMUTABLE RETURNS NULL ON NULL INPUT SECURITY INVOKER;

Thanks for your help,

Marc Mamin;

Browse pgsql-sql by date

  From Date Subject
Next Message Louis-David Mitterrand 2008-09-22 14:34:14 exclusion query
Previous Message Joe 2008-09-21 14:58:47 Re: ORDER BY collation order