Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.8.8/8.7.5) with ESMTP id PAA22521 for ; Mon, 13 Jul 1998 15:39:02 -0400 (EDT) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id PAA10695 for ; Mon, 13 Jul 1998 15:21:47 -0400 (EDT) To: pgsql-sql@postgresql.org Subject: Conversion from Unix timestamp to datetime? Date: Mon, 13 Jul 1998 15:21:47 -0400 Message-ID: <10692.900357707@sss.pgh.pa.us> From: Tom Lane I'd like to be able to convert between times specified in Unix timestamp format and SQL datetime values without going through the slow and rather error-prone process of converting to a human-readable date notation. I see how to get a datetime value returned as a Unix timestamp: tgl=> select date_part('epoch', 'now'::datetime); date_part --------- 900355156 (1 row) But I don't see any way to supply a value in the form "900355156" and have it get converted to datetime. Is there a way to do that? BTW, it seems like the standard data type 'timestamp' ought to be good for this, but it isn't as far as I can tell ... it hasn't got any working conversions to/from integer either. regards, tom lane