pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
int to date
2+ messages / 2 participants
[nested] [flat]

* int to date
@ 2005-07-25 08:54 Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>
  2005-07-25 16:14 ` Re: int to date Bruno Wolff III <bruno@wolff.to>
  0 siblings, 1 reply; 2+ messages in thread

From: Daniel Drotos @ 2005-07-25 08:54 UTC (permalink / raw)
  To: pgsql-sql

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...

Daniel



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: int to date
  2005-07-25 08:54 int to date Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>
@ 2005-07-25 16:14 ` Bruno Wolff III <bruno@wolff.to>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruno Wolff III @ 2005-07-25 16:14 UTC (permalink / raw)
  To: Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>; +Cc: pgsql-sql

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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-07-25 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25 08:54 int to date Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>
2005-07-25 16:14 ` Bruno Wolff III <bruno@wolff.to>

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