Hi, I want to get data from potgree SQL. There is a column in type timestamp without timezone. Simple SELECT returns me formated date but I want timestamp in miliseconds simply. How I can do it in SQL? Thx for answers. Kamilos
+1
A:
select extract(epoch from my_timestamp)
This returns time in seconds. For millis, use:
select extract(epoch from my_timestamp)*1000
Test:
select my_date,
extract(epoch from my_date)*interval'1s'+'epoch'::timestamp at time zone 'GMT'
Konrad Garus
2010-08-03 09:23:37
great! it works, thanks man!
Kamilos
2010-08-03 09:30:15