tags:

views:

28

answers:

1

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
great! it works, thanks man!
Kamilos