[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    [SQL] varchar::timezone conversion
From:       "Marc Mamin" <M.Mamin () intershop ! de>
Date:       2008-09-22 10:55:24
Message-ID: CA896D7906BF224F8A6D74A1B7E54AB3039E8B85 () JENMAIL01 ! ad ! intershop ! net
[Download RAW message or body]


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;

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic