Re: How to typecast an integer into a timestamp? - Mailing list pgsql-general

From Jasen Betts
Subject Re: How to typecast an integer into a timestamp?
Date
Msg-id jiaan9$r81$1@reversiblemaps.ath.cx
Whole thread Raw
In response to How to typecast an integer into a timestamp?  (bboett@free.fr)
List pgsql-general
On 2012-01-27, bboett@free.fr <bboett@free.fr> wrote:
> Hello!
>
> again quite a stupid problem i regularly run into....
> and that i still haven't solved yet...
>
> again i used a type timestamp to keep a track of modification time,
> and again it gets stupid and confusing.....

oops!  (when recording events timestamp with timezone is usually best)

> first of all the errors are labeled as timestamp without timezone, i
> only specified timestamp....

it's the same thing since 8.1

> the data was created as a timestamp with php-mktime, but when
> sending to the database postgres complains that its an int, and when i
> try to typecast it, (with the ::timestamp appendix to the value), that
> its not possible to convert an int to a timestamp (without timezone)
> .....

> so as usual i would discard the timezone datatype and alter the
> table to use integer instead, but this time i am wondering, since this
> datatype is present, there's surely a way to use it properly? but how?

just use a string in this format "YYYY-MM-DD HH:MM:SS.sssssss +NN:NN"



--
⚂⚃ 100% natural

pgsql-general by date:

Previous
From: Jasen Betts
Date:
Subject: Re: Behavior of subselects in target lists and order by
Next
From: Scott Ribe
Date:
Subject: Rails & pg setup question