Re: Get Unix timestamp from SQL timestamp through libpq - Mailing list pgsql-general

From Yan Cheng Cheok
Subject Re: Get Unix timestamp from SQL timestamp through libpq
Date
Msg-id 480708.86033.qm@web65709.mail.ac4.yahoo.com
Whole thread Raw
In response to Re: Get Unix timestamp from SQL timestamp through libpq  (Vincenzo Romano <vincenzo.romano@notorand.it>)
List pgsql-general
Not working. strftime is use to convert date and time to a string.

Thanks and Regards
Yan Cheng CHEOK


--- On Mon, 1/11/10, Vincenzo Romano <vincenzo.romano@notorand.it> wrote:

> From: Vincenzo Romano <vincenzo.romano@notorand.it>
> Subject: Re: [GENERAL] Get Unix timestamp from SQL timestamp through libpq
> To: "Yan Cheng Cheok" <yccheok@yahoo.com>
> Cc: pgsql-general@postgresql.org
> Date: Monday, January 11, 2010, 3:25 PM
> man 3 strftime
>
>
> 2010/1/11 Yan Cheng Cheok <yccheok@yahoo.com>:
> > I try already. Neither of them can accept string
> parameter, and convert them to unit timestamp (long).
> >
> > Thanks and Regards
> > Yan Cheng CHEOK
> >
> >
> > --- On Mon, 1/11/10, Vincenzo Romano <vincenzo.romano@notorand.it>
> wrote:
> >
> >> From: Vincenzo Romano <vincenzo.romano@notorand.it>
> >> Subject: Re: Get Unix timestamp from SQL timestamp
> through libpq
> >> To: "Yan Cheng Cheok" <yccheok@yahoo.com>
> >> Cc: pgsql-general@postgresql.org
> >> Date: Monday, January 11, 2010, 2:58 PM
> >> Give a try to:
> >>
> >> man 2 time
> >> man 3 ctime
> >>
> >>
> >> 2010/1/11 Yan Cheng Cheok <yccheok@yahoo.com>:
> >> > I know I can convert SQL timestamp to unix
> timestamp,
> >> using the following way.
> >> >
> >> > SELECT extract(epoch FROM now());
> >> >
> >> > Now, I have a stored procedure function,
> which will
> >> directly return a table row to the caller. One of
> the row
> >> field is "timestamp" type.
> >> >
> >> > In my application, I am using libpq. I wish
> to use
> >> libpq functions (or any c/c++ function), to
> convert
> >> "2010-01-11 13:10:55.283" into unix timestamp. Off
> course, I
> >> can create another stored procedure named
> >> >
> >> > SQLTimestamp2UnixTimestamp
> >> > SELECT extract(epoch FROM $1);
> >> >
> >> > But I just wish to accomplish this task with
> a single
> >> c/c++ function call, without involving stored
> procedure.
> >> >
> >> > Any suggestion? Thanks!
> >> >
> >> > Thanks and Regards
> >> > Yan Cheng CHEOK
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> >> > To make changes to your subscription:
> >> > http://www.postgresql.org/mailpref/pgsql-general
> >> >
> >>
> >>
> >>
> >> --
> >> Vincenzo Romano
> >> NotOrAnd Information Technologies
> >> cel. +39 339 8083886  | gtalk. vincenzo.romano@notorand.it
> >> fix. +39 0823 454163  | skype. notorand.it
> >> fax. +39 02 700506964 | msn.   notorand..it
> >> NON QVIETIS MARIBVS NAVTA PERITVS
> >>
> >
> >
> >
> >
> >
>
>
>
> --
> Vincenzo Romano
> NotOrAnd Information Technologies
> cel. +39 339 8083886  | gtalk. vincenzo.romano@notorand.it
> fix. +39 0823 454163  | skype. notorand.it
> fax. +39 02 700506964 | msn.   notorand.it
> NON QVIETIS MARIBVS NAVTA PERITVS
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>





pgsql-general by date:

Previous
From: Vincenzo Romano
Date:
Subject: Re: Get Unix timestamp from SQL timestamp through libpq
Next
From: Thilo Schneider
Date:
Subject: Set Returning C-Function with cache over multiple calls (with different arguments)