Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. time_t curdate = time(0);
  2. struct tm * tm_curdate = gmtime(&curdate);
  3. char date_buf[11];
  4. strftime(date_buf, 11, "%Y-%m-%d", tm_curdate);
  5.  
  6. std::stringstream buf;
  7. buf << "SELECT ..."
  8. " WHERE my_date >= DATE_SUB(" << date_buf << ", INTERVAL 28 DAY)" <<
  9. " LIMIT 1";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement