pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: int to date
Date: Mon, 25 Jul 2005 11:14:35 -0500
Message-ID: <20050725161435.GA16147@wolff.to> (raw)
In-Reply-To: <Pine.LNX.4.61.0507251046400.2731@mazsola.iit.uni-miskolc.hu>
References: <20050707201433.94901.qmail@web41013.mail.yahoo.com>
	<DC3A639A-7409-419C-9D1A-DABC091873F1@khera.org>
	<Pine.LNX.4.61.0507251046400.2731@mazsola.iit.uni-miskolc.hu>

On Mon, Jul 25, 2005 at 10:54:42 +0200,
  Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu> 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.



view thread (2+ messages)

Message-ID: <20050725161435.GA16147@wolff.to>
Permalink:  ../20050725161435.GA16147@wolff.to/
Also on:    postgresql.org/message-id/20050725161435.GA16147@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, drdani@mazsola.iit.uni-miskolc.hu
  Subject: Re: int to date
  In-Reply-To: <20050725161435.GA16147@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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