Re: timestamp- milliseconds since epoch output

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jkakar(at)expressus(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: timestamp- milliseconds since epoch output
Date: 2001-02-06 23:57:17
Message-ID: 26381.981503837@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

jkakar(at)expressus(dot)com writes:
> I've tried using variations of to_char and to_timestamp but can't seem
> to get the timestamp as a value of milliseconds since the Epoch (Jan
> 1, 1970).

regression=# select date_part('epoch','2001-02-05 17:23:26.123456-08'::timestamp);
date_part
------------------
981422606.123456
(1 row)

Multiply by 1000 if you feel a strong urge to have it in milliseconds...

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Poet/Joshua Drake 2001-02-07 00:26:17 Re: Postgres-HOWTO
Previous Message Ross J. Reedstrom 2001-02-06 23:55:39 Re: [SQL] Re: SQL Join - MySQL/PostgreSQL difference?