X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 13B84529D7 for ; Mon, 25 Jul 2005 13:13:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18023-05 for ; Mon, 25 Jul 2005 16:13:41 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 2E19A529DF for ; Mon, 25 Jul 2005 13:13:40 -0300 (ADT) Received: (qmail 18973 invoked by uid 500); 25 Jul 2005 16:14:35 -0000 Date: Mon, 25 Jul 2005 11:14:35 -0500 From: Bruno Wolff III To: Daniel Drotos Cc: pgsql-sql@postgresql.org Subject: Re: int to date Message-ID: <20050725161435.GA16147@wolff.to> Mail-Followup-To: Bruno Wolff III , Daniel Drotos , pgsql-sql@postgresql.org References: <20050707201433.94901.qmail@web41013.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/220 X-Sequence-Number: 22198 On Mon, Jul 25, 2005 at 10:54:42 +0200, Daniel Drotos wrote: > Hi, > > I have a string containing hexa dump of an 4 bytes integer, like > '6AF4805C'. Is it possible to convert it somehow to date type in > plpgsql (v8.0.0-rc1)? Doc says that date is represented as 4 bytes > internaly. > > How can I get internal representation of a date type field? So I would > be able to produce hexa dump of it like above... area=> select x'6AF4805C'::integer::abstime; abstime ------------------------ 2026-11-11 08:49:00-06 (1 row) It looks like the your number probably isn't an offset in seconds from January 1 1970. But with more knowledge about what it is, you should be able to turn it into a date or timestamp.