Advertisement
Zuhairy_Harry

Insert Timestamp C++

Jan 14th, 2024
1,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. if ((choice_date == "y") || (choice_date == "Y")) {
  2.  
  3.     if (manualTimestamp.tm_mon < 10) {
  4.         if (manualTimestamp.tm_mday < 10) {
  5.             cout << "Date: " << manualTimestamp.tm_year << "-0" << manualTimestamp.tm_mon << "-0" << manualTimestamp.tm_mday << " " << manualTimestamp.tm_hour << ":" << manualTimestamp.tm_min << ":" << manualTimestamp.tm_sec << endl;
  6.         }
  7.         else {
  8.             cout << "Date: " << manualTimestamp.tm_year << "-0" << manualTimestamp.tm_mon << "-" << manualTimestamp.tm_mday << " " << manualTimestamp.tm_hour << ":" << manualTimestamp.tm_min << ":" << manualTimestamp.tm_sec << endl;
  9.         }
  10.        
  11.     }
  12.     else {
  13.         if (manualTimestamp.tm_mday < 10) {
  14.             cout << "Date: " << manualTimestamp.tm_year << "-" << manualTimestamp.tm_mon << "-0" << manualTimestamp.tm_mday << " " << manualTimestamp.tm_hour << ":" << manualTimestamp.tm_min << ":" << manualTimestamp.tm_sec << endl;
  15.         }
  16.         else {
  17.             cout << "Date: " << manualTimestamp.tm_year << "-" << manualTimestamp.tm_mon << "-" << manualTimestamp.tm_mday << " " << manualTimestamp.tm_hour << ":" << manualTimestamp.tm_min << ":" << manualTimestamp.tm_sec << endl;
  18.         }
  19.     }
  20.    
  21. }
  22. else {
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement