dbTalk Databases Forums  

Re: how to convert time_t to ANSI SQL format DateTime string(2005-05-02

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Re: how to convert time_t to ANSI SQL format DateTime string(2005-05-02 in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Earl Miles
 
Posts: n/a

Default Re: how to convert time_t to ANSI SQL format DateTime string(2005-05-02 - 05-02-2005 , 11:07 AM






zlf wrote:
Quote:
Hi,
May anyone tell me how to change datetime with Unix format(Mon May 02
10:09:09 2005) to ANSI SQL format(2005-05-02 10:09:09) or directly convert
time_t to ANSI SQL format string.
I am developing a log program using C++ and Mysql. I want to inserting
time data into a DateTime-type column. Mysql requires datetime with ANSI SQL
format. However ctime ( time_t * time ) returns value like 'Mon May 02
10:09:09 2005'(datetime with Unix format).
thx
zlf
use strftime() which lets you format a date however you want.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.