§2024-12-03

¶Date and Time

The library allows us to work with dates and times.

// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;

int main() {
  // Get the timestamp for the current date and time
    time_t timestamp;
    time(&timestamp);
    
    // Display the date and time represented by the timestamp
    cout << ctime(&timestamp);

  return 0;
} // Tue Dec  3 06:31:20 2024