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

* Re: converting big int to date
@ 2011-03-23 21:12  Sree <mail2mail@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Sree @ 2011-03-23 21:12 UTC (permalink / raw)
  To: pgsql-sql

How can i convert bigint to date format.

bigint=616962528000000000

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

* Re: converting big int to date
@ 2011-03-24 16:30  Vibhor Kumar <vibhor.kumar@enterprisedb.com>
  parent: Sree <mail2mail@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Vibhor Kumar @ 2011-03-24 16:30 UTC (permalink / raw)
  To: Sree <mail2mail@gmail.com>; +Cc: pgsql-sql


On Mar 24, 2011, at 2:42 AM, Sree wrote:

> How can i convert bigint to date format.
> 
> bigint=616962528000000000


Please explain what;s this value shows.

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com




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

* Re: converting big int to date
@ 2011-03-26 10:04  Jasen Betts <jasen@xnet.co.nz>
  parent: Sree <mail2mail@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Jasen Betts @ 2011-03-26 10:04 UTC (permalink / raw)
  To: pgsql-sql

On 2011-03-23, Sree <mail2mail@gmail.com> wrote:
> --90e6ba2123fbe15f02049f2ccf73
> Content-Type: text/plain; charset=ISO-8859-1
>
> How can i convert bigint to date format.
>
> bigint=616962528000000000


that's got the right number of zeros to
be a date expressed as microseconds since epoch

in which case the magic spell is

 select 'epoch'::timestamptz 
           + '1s'::interval 
               * (616962528000000000::bigint /1000000000.0);
      
 gives me a date in 1989
 
if it's some from a microsoft inspored system instead of AT&T inspired
you might need to add '10 years'::interval to the result.

-- 
⚂⚃ 100% natural




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

* Re: converting big int to date
@ 2011-03-27 08:32  Jasen Betts <jasen@xnet.co.nz>
  parent: Jasen Betts <jasen@xnet.co.nz>
  0 siblings, 0 replies; 4+ messages in thread

From: Jasen Betts @ 2011-03-27 08:32 UTC (permalink / raw)
  To: pgsql-sql

On 2011-03-26, Jasen Betts <jasen@xnet.co.nz> wrote:


> that's got the right number of zeros to
> be a date expressed as microseconds since epoch

except the code which produces a likely data treats it as nanoseconds....




-- 
⚂⚃ 100% natural




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


end of thread, other threads:[~2011-03-27 08:32 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23 21:12 Re: converting big int to date Sree <mail2mail@gmail.com>
2011-03-24 16:30 ` Vibhor Kumar <vibhor.kumar@enterprisedb.com>
2011-03-26 10:04 ` Jasen Betts <jasen@xnet.co.nz>
2011-03-27 08:32   ` Jasen Betts <jasen@xnet.co.nz>

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