List:MySQL++« Previous MessageNext Message »
From:Earl Miles Date:May 2 2005 4:06pm
Subject:Re: how to convert time_t to ANSI SQL format DateTime string(2005-05-02
10:09:09).
View as plain text  
zlf wrote:
> 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.
Thread
how to convert time_t to ANSI SQL format DateTime string(2005-05-02 10:09:09).zlf2 May
  • Re: how to convert time_t to ANSI SQL format DateTime string(2005-05-02 10:09:09).Chris Frey2 May
  • Re: how to convert time_t to ANSI SQL format DateTime string(2005-05-0210:09:09).Earl Miles2 May
  • Re: how to convert time_t to ANSI SQL format DateTime string(2005-05-02 10:09:09).zlf6 May