Pages

Monday, June 8, 2015

convert long to readable date in postgres

convert long to readable date in postgres

Say I have stored the date in long data type ( Java) in Postgres.

Now I want to parse to human readable format via postgres query .

How can I do it ?

Here is a simple query obtained from stackoverflow.com

select *, to_timestamp(time in milli sec / 1000) from mytable

For example, if the value is 1433761500071 then the query will be


select  to_timestamp(1433761500071 / 1000) from mytable
 
Which will give output as

"2015-06-08 16:35:00+05:30"

Solution:
 
http://stackoverflow.com/questions/7872720/convert-date-from-long-time-postgres

No comments:

Post a Comment