Re: any way to convert date via libpq?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Title: RE: any way to convert date via libpq?

Hi Scott,

Many thanks for your reply.
I just tried:
  select extract (epoch from timestamp with time zone '2008-04-04 20:00:0.0');
and got:
  1207364400
which is great!

I suppose there is no problem running this query
via PGexec() in a C program?  Something like:
  result = PGexec (conn, "FETCH ALL from somePort");

Many thanks.

Regards,

Tena Sakai
tsakai@xxxxxxxxxxxxxx

-----Original Message-----
From: Scott Marlowe [mailto:scott.marlowe@xxxxxxxxx]
Sent: Tue 3/10/2009 9:55 PM
To: Tena Sakai
Cc: pgsql-admin@xxxxxxxxxxxxxx
Subject: Re: any way to convert date via libpq?

On Tue, Mar 10, 2009 at 8:43 PM, Tena Sakai <tsakai@xxxxxxxxxxxxxx> wrote:
> Hi Everybody,
>
> I have a C program to read a postgres table.  One of
> the columns of this table is defined as:
>
>   timestamp without time zone
>
> Is there any routine/function that I can use to convert
> this field/column value into unix/linux style date for
> comparison purpose?

select extract('epoch' from timestampfield) ;


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux