pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
biginteger to timestamp
6+ messages / 5 participants
[nested] [flat]

* biginteger to timestamp
@ 2006-07-20 09:26 LiveShell <liveshell@gmail.com>
  2006-07-20 09:32 ` Re: biginteger to timestamp Peter Eisentraut <peter_e@gmx.net>
  2006-07-20 09:32 ` Re: biginteger to timestamp hubert depesz lubaczewski <depesz@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: LiveShell @ 2006-07-20 09:26 UTC (permalink / raw)
  To: pgsql-admin

Hi all,
         I want to convert biginteger and integer data type to timestamp
data type.
Can any body tell me how to convert??

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

* Re: biginteger to timestamp
  2006-07-20 09:26 biginteger to timestamp LiveShell <liveshell@gmail.com>
@ 2006-07-20 09:32 ` Peter Eisentraut <peter_e@gmx.net>
  1 sibling, 0 replies; 6+ messages in thread

From: Peter Eisentraut @ 2006-07-20 09:32 UTC (permalink / raw)
  To: pgsql-admin; +Cc: LiveShell <liveshell@gmail.com>

Am Donnerstag, 20. Juli 2006 11:26 schrieb LiveShell:
>          I want to convert biginteger and integer data type to timestamp
> data type.

That depends mostly on what kind of meaning you intend to attach to an integer 
N.   If you want seconds since 1970, you could do

x * interval '1 second' + timestamp '1970-01-01'

For other meanings, adjust as necessary.
-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



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

* Re: biginteger to timestamp
  2006-07-20 09:26 biginteger to timestamp LiveShell <liveshell@gmail.com>
@ 2006-07-20 09:32 ` hubert depesz lubaczewski <depesz@gmail.com>
  2006-07-20 09:41   ` Re: biginteger to timestamp LiveShell <liveshell@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: hubert depesz lubaczewski @ 2006-07-20 09:32 UTC (permalink / raw)
  To: LiveShell <liveshell@gmail.com>; +Cc: pgsql-admin

On 7/20/06, LiveShell <liveshell@gmail.com> wrote:
>
> Hi all,
>          I want to convert biginteger and integer data type to timestamp
> data type.
> Can any body tell me how to convert??
>

and what is in this biginteger?
is it something like:
20060720113254::bigint
or rather something like "seconds from epoch"?
or something totally different?

depesz

-- 
http://www.depesz.com/ - nowy, lepszy depesz

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

* Re: biginteger to timestamp
  2006-07-20 09:26 biginteger to timestamp LiveShell <liveshell@gmail.com>
  2006-07-20 09:32 ` Re: biginteger to timestamp hubert depesz lubaczewski <depesz@gmail.com>
@ 2006-07-20 09:41   ` LiveShell <liveshell@gmail.com>
  2006-07-20 11:41     ` Re: biginteger to timestamp Ben K. <bkim@coe.tamu.edu>
  2006-07-21 17:47     ` Re: biginteger to timestamp Bruno Wolff III <bruno@wolff.to>
  0 siblings, 2 replies; 6+ messages in thread

From: LiveShell @ 2006-07-20 09:41 UTC (permalink / raw)
  To: hubert depesz lubaczewski <depesz@gmail.com>; +Cc: pgsql-admin

hi hubert
actally i have UNIX time and that is in *1153222974*  format. and i m using
C api to insert this time in a column whose type is timestamp.
so now can u tell me .... how can i convert it to timestamp and insert into
the timestamp column.


On 7/20/06, hubert depesz lubaczewski <depesz@gmail.com> wrote:
>
> On 7/20/06, LiveShell <liveshell@gmail.com> wrote:
> >
> > Hi all,
> >          I want to convert biginteger and integer data type to timestamp
> > data type.
> > Can any body tell me how to convert??
> >
>
> and what is in this biginteger?
> is it something like:
> 20060720113254::bigint
> or rather something like "seconds from epoch"?
> or something totally different?
>
> depesz
>
> --
> http://www.depesz.com/ - nowy, lepszy depesz
>

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

* Re: biginteger to timestamp
  2006-07-20 09:26 biginteger to timestamp LiveShell <liveshell@gmail.com>
  2006-07-20 09:32 ` Re: biginteger to timestamp hubert depesz lubaczewski <depesz@gmail.com>
  2006-07-20 09:41   ` Re: biginteger to timestamp LiveShell <liveshell@gmail.com>
@ 2006-07-20 11:41     ` Ben K. <bkim@coe.tamu.edu>
  1 sibling, 0 replies; 6+ messages in thread

From: Ben K. @ 2006-07-20 11:41 UTC (permalink / raw)
  To: LiveShell <liveshell@gmail.com>; +Cc: hubert depesz lubaczewski <depesz@gmail.com>; pgsql-admin

> actally i have UNIX time and that is in *1153222974*  format. and i m using

select to_timestamp(1153222974);
http://www.postgresql.org/docs/8.1/static/functions-formatting.html

if you're on 8.1.

HTH.

Ben K.
Developer
http://benix.tamu.edu



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

* Re: biginteger to timestamp
  2006-07-20 09:26 biginteger to timestamp LiveShell <liveshell@gmail.com>
  2006-07-20 09:32 ` Re: biginteger to timestamp hubert depesz lubaczewski <depesz@gmail.com>
  2006-07-20 09:41   ` Re: biginteger to timestamp LiveShell <liveshell@gmail.com>
@ 2006-07-21 17:47     ` Bruno Wolff III <bruno@wolff.to>
  1 sibling, 0 replies; 6+ messages in thread

From: Bruno Wolff III @ 2006-07-21 17:47 UTC (permalink / raw)
  To: LiveShell <liveshell@gmail.com>; +Cc: hubert depesz lubaczewski <depesz@gmail.com>; pgsql-admin

On Thu, Jul 20, 2006 at 15:11:35 +0530,
  LiveShell <liveshell@gmail.com> wrote:
> hi hubert
> actally i have UNIX time and that is in *1153222974*  format. and i m using
> C api to insert this time in a column whose type is timestamp.
> so now can u tell me .... how can i convert it to timestamp and insert into
> the timestamp column.

Note that you should be using "timestamp with time zone" (timestamptz) for
this rather than "timestamp".



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


end of thread, other threads:[~2006-07-21 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-20 09:26 biginteger to timestamp LiveShell <liveshell@gmail.com>
2006-07-20 09:32 ` Peter Eisentraut <peter_e@gmx.net>
2006-07-20 09:32 ` hubert depesz lubaczewski <depesz@gmail.com>
2006-07-20 09:41   ` LiveShell <liveshell@gmail.com>
2006-07-20 11:41     ` Ben K. <bkim@coe.tamu.edu>
2006-07-21 17:47     ` 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