Re: Get Unix timestamp from SQL timestamp through libpq

From: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
To: Yan Cheng Cheok <yccheok(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Get Unix timestamp from SQL timestamp through libpq
Date: 2010-01-11 06:58:38
Message-ID: 3eff28921001102258y32264df2o61eb69ac19e756bb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Give a try to:

man 2 time
man 3 ctime

2010/1/11 Yan Cheng Cheok <yccheok(at)yahoo(dot)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(at)postgresql(dot)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(dot)romano(at)notorand(dot)it
fix. +39 0823 454163 | skype. notorand.it
fax. +39 02 700506964 | msn. notorand.it
NON QVIETIS MARIBVS NAVTA PERITVS

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yan Cheng Cheok 2010-01-11 07:23:21 Re: Get Unix timestamp from SQL timestamp through libpq
Previous Message Anisha Kaul 2010-01-11 06:37:27 Re: pgsql2shp usage