convert timestamp to number ?

From: Matus fantomas Uhlar <uhlar(at)fantomas(dot)sk>
To: pgsql-novice(at)postgresql(dot)org
Subject: convert timestamp to number ?
Date: 2001-05-14 15:09:42
Message-ID: 20010514170942.A13133@fantomas.sk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello,

I am processing a query that should return more timestamps, and wouls like
to get them as number...

+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| userid | text not null | var |
| uid | int4 | 4 |

...

| dt_modify | timestamp | 8 |

...

| dt_export | timestamp | 8 |
+----------------------------------+----------------------------------+-------+

there are more timestamp fields and I wanna load them to C program and
compare them there. (well situation wouldn't be different if it would be
perl program).

I can convert number to timestamp this way:

setup=> update www set dt_export=timestamp(0) where dt_export is not null;
UPDATE 1

setup=> select userid,uid,dt_modify,dt_export from www where dt_export is not NULL;
userid| uid|dt_modify |dt_export
------+----+----------------------+---------
uhlar |1006|2001-04-18 17:12:59+02|epoch
(1 row)

but I'd like to get those timestamps back in integer format. Is that
possible?

--
Matus "fantomas" Uhlar, sysadmin at NEXTRA, Slovakia; IRCNET admin of *.sk
uhlar(at)fantomas(dot)sk ; http://www.fantomas.sk/ ; http://www.nextra.sk/
There's a long-standing bug relating to the x86 architecture that
allows you to install Windows. -- Matthew D. Fuller

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Strickland 2001-05-14 15:23:58 Inheritence-relations problem
Previous Message Brett W. McCoy 2001-05-14 11:08:52 Re: Linking postgres databases