Sunday, 15 March 2015

c++ - Using time_t with mysql instead of CURDATE -



c++ - Using time_t with mysql instead of CURDATE -

i trying remove 28 days current date, , utilize in mysql. don't want utilize curdate() have caching, ma doing :

time_t curdate = time(0); struct tm * tm_curdate = gmtime(&curdate); char date_buf[11]; strftime(date_buf, 11, "%y-%m-%d", tm_curdate); std::stringstream buf; buf << "select ..." " my_date >= date_sub(" << date_buf << ", interval 28 day)" << " limit 1";

unfortunately, wrong in there (it compiles, seems not render @ execution, if utilize curdate(), works fine ...), can't figure out what.

any thought ?

thanks.

c++ mysql

No comments:

Post a Comment