Unix time stamp function?

Started by Steve Micallefalmost 25 years ago3 messagesgeneral
Jump to latest
#1Steve Micallef
stevenm@ot.com.au

Hi,

I store Unix time stamps (seconds since Jan 1 1970) in my database. I was
hoping there was an SQL/PostgreSQL function for converting a unix time
stamp into a readable date/time string?

I've searched the documentation, and there only seems to be functions
which deal with time stamps (XXXX-XX-XX XX:XX:XX).

Thanks in advance,

Steve Micallef

#2Noname
alla@sergey.com
In reply to: Steve Micallef (#1)
Re: Unix time stamp function?

this works for me: timestamp(your_variable)

Alla

stevenm@ot.com.au (Steve Micallef) wrote in message news:<20010613103614.W37166-100000@toaster.syd.ot>...

Show quoted text

Hi,

I store Unix time stamps (seconds since Jan 1 1970) in my database. I was
hoping there was an SQL/PostgreSQL function for converting a unix time
stamp into a readable date/time string?

I've searched the documentation, and there only seems to be functions
which deal with time stamps (XXXX-XX-XX XX:XX:XX).

Thanks in advance,

Steve Micallef

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

#3(J.H.M. Dassen \(Ray\))
jdassen@cistron.nl
In reply to: Steve Micallef (#1)
Re: Unix time stamp function?

Steve Micallef <stevenm@ot.com.au> wrote:

I store Unix time stamps (seconds since Jan 1 1970) in my database. I was
hoping there was an SQL/PostgreSQL function for converting a unix time
stamp into a readable date/time string?

You can use something like
to_char(timestamp(foo), 'DD-MM-YYYY HH24:MI:SS')

HTH,
Ray
--
USDoJ/Judge Jackson: "Microsoft has performed an illegal operation and will
be shut down."
James Turinsky in alt.sysadmin.recovery