date/time function

Started by Sterpu Victorover 20 years ago3 messagesgeneral
Jump to latest
#1Sterpu Victor
victor@ambra.ro

I need a function that will transform from the format '2002-09-08
05:29:41' to seconds since 1970.

Thank you.

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Sterpu Victor (#1)
Re: date/time function

am 01.12.2005, um 11:07:59 +0200 mailte Sterpu Victor folgendes:

I need a function that will transform from the format '2002-09-08 05:29:41'
to seconds since 1970.

scholl=# select now();
now
-------------------------------
2005-12-01 10:18:47.554236+01
(1 row)

scholl=# select extract (epoch from now());
date_part
------------------
1133428728.47011
(1 row)

scholl=# select extract (epoch from now())::int;
date_part
------------
1133428743
(1 row)

HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

#3Terry Lee Tucker
terry@esc1.com
In reply to: Sterpu Victor (#1)
Re: date/time function

rnd=# select extract(epoch from timestamp '2002-09-08 05:29:41');
date_part
------------
1031477381
(1 row)

See the date/time functions documentation.

On Thursday 01 December 2005 04:07 am, Sterpu Victor saith:

Show quoted text

I need a function that will transform from the format '2002-09-08
05:29:41' to seconds since 1970.

Thank you.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings