pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
timestamp- milliseconds since epoch output
3+ messages / 3 participants
[nested] [flat]

* timestamp- milliseconds since epoch output
@ 2001-02-06 18:39  jkakar@expressus.com
  0 siblings, 2 replies; 3+ messages in thread

From: jkakar@expressus.com @ 2001-02-06 18:39 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I'm using a timestamp field called date_created.  Whenever I select it
I get:

select date_created from tbl_user;
      date_created      
------------------------
 2001-02-05 17:23:26-08
 2001-02-05 17:45:39-08
 2001-02-03 03:58:53-08
(3 rows)

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).  I've been looking through the user manual but can't seem to
find anything... might be nice to put it in there as this is probably
a very common operation.

Any ideas?

Thanks,
Jamu.

-- 
Jamu Kakar (Developer)			Expressus Design Studio, Inc.
jkakar@expressus.com			708-1641 Lonsdale Avenue
V: (604) 903-6994			North Vancouver, BC, V7M 2J5



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: timestamp- milliseconds since epoch output
@ 2001-02-06 18:49  Karel Zak <zakkr@zf.jcu.cz>
  parent: jkakar@expressus.com
  1 sibling, 0 replies; 3+ messages in thread

From: Karel Zak @ 2001-02-06 18:49 UTC (permalink / raw)
  To: jkakar@expressus.com; +Cc: pgsql-sql


On Tue, 6 Feb 2001 jkakar@expressus.com wrote:

> Hi,
> 
> I'm using a timestamp field called date_created.  Whenever I select it
> I get:
> 
> select date_created from tbl_user;
>       date_created      
> ------------------------
>  2001-02-05 17:23:26-08
>  2001-02-05 17:45:39-08
>  2001-02-03 03:58:53-08
> (3 rows)
> 
> 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

 to_char() and to_timestamp() are milliseconds ignorant routines. It's in 
my TODO list for next release -- now we in feature freeze state. 

			Karel




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: timestamp- milliseconds since epoch output
@ 2001-02-06 23:57  Tom Lane <tgl@sss.pgh.pa.us>
  parent: jkakar@expressus.com
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2001-02-06 23:57 UTC (permalink / raw)
  To: jkakar@expressus.com; +Cc: pgsql-sql

jkakar@expressus.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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-02-06 23:57 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-06 18:39 timestamp- milliseconds since epoch output jkakar@expressus.com
2001-02-06 18:49 ` Karel Zak <zakkr@zf.jcu.cz>
2001-02-06 23:57 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox