Get Unix timestamp from SQL timestamp through libpq

Поиск
Список
Период
Сортировка
От Yan Cheng Cheok
Тема Get Unix timestamp from SQL timestamp through libpq
Дата
Msg-id 938588.91925.qm@web65716.mail.ac4.yahoo.com
обсуждение исходный текст
Ответы Re: Get Unix timestamp from SQL timestamp through libpq  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Re: Get Unix timestamp from SQL timestamp through libpq  (Craig Ringer <craig@postnewspapers.com.au>)
Re: Get Unix timestamp from SQL timestamp through libpq  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Re: Get Unix timestamp from SQL timestamp through libpq  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
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





В списке pgsql-general по дате отправления:

Предыдущее
От: Yan Cheng Cheok
Дата:
Сообщение: Re: Return Single Row Result After Inserting (Stored Procedure)
Следующее
От: Anisha Kaul
Дата:
Сообщение: Re: pgsql2shp usage