Advertisement
obernardovieira

Time to String

Mar 7th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. //not by me
  2.  
  3. #include <cstdio>
  4. #include <ctime>
  5.  
  6. int main ()
  7. {
  8.     std::time_t rawtime;
  9.     std::tm* timeinfo;
  10.     char buffer [80];
  11.  
  12.     std::time(&rawtime);
  13.     timeinfo = std::localtime(&rawtime);
  14.  
  15.     std::strftime(buffer,80,"%Y-%m-%d-%H-%M-%S",timeinfo);
  16.     std::puts(buffer);
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement