- Version
- Download 13
- File Size 1.33 KB
- File Count 1
- Create Date April 18, 2016
- Last Updated April 18, 2016
Display Date and Time in C++
Display Date and Time in C++
Example c++ program that gets and display the system of your computer. The program will demonstrate two ways on how to display the time; one is by getting the real time of your system and another is by timestamp.
Happy Coding!
Source code:
#include < iostream >
#include < ctime >
using namespace std;
int main()
{
time_t datetime = time(0);
char * dt = ctime(&datetime);
cout << "The system date and time is: " << dt << endl;
cout <<"Date and Time using timestamp: "<< __TIMESTAMP__ << endl;
return 0;
}