Re: Trigger to convert UNIX time to timestamp without time zone. - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Trigger to convert UNIX time to timestamp without time zone.
Date
Msg-id 20140606133928.GD25470@crankycanuck.ca
Whole thread Raw
In response to Trigger to convert UNIX time to timestamp without time zone.  (Alberto Olivares <alberto.olivares@snowflakesoftware.com>)
Responses Re: Trigger to convert UNIX time to timestamp without time zone.
List pgsql-general
On Fri, Jun 06, 2014 at 02:19:50PM +0100, Alberto Olivares wrote:
> How can I create a trigger to transform the time from UNIX to timestamp
> without time zone every time a new record is inserted into my database?

This is in the manual, section 9.8: to_timestamp(double precision)

It's always a little confusing when you go to look it up, because it's
not with the date and time functions, because it's actually a
formatting issue.  (There's a cross reference, but if you don't know
this is just a formatting issue you won't know to follow the
reference.)  You probably don't need a trigger, just put that in your
query.

Are you sure you want this without time zone?  In my experience,
almost every time people think they want "without time zone" they
actually don't.

A


--
Andrew Sullivan
ajs@crankycanuck.ca


pgsql-general by date:

Previous
From: Stefan Froehlich
Date:
Subject: Re: interpret bytea output as text / double encode()
Next
From: Adrian Klaver
Date:
Subject: Re: PostgreSQL 9.2.4 + CentOS 6.5 64 bit - segfault error in initdb