I wrote a function to get a current date and time in format: DD-MM-YYYY HH:MM:SS. It works but let\'s say, its pretty ugly. How can I do exactly the sam
DD-MM-YYYY HH:MM:SS
you can use asctime() function of time.h to get a string simply .
time_t _tm =time(NULL ); struct tm * curtime = localtime ( &_tm ); cout<<"The current date/time is:"<
Sample output:
The current date/time is:Fri Oct 16 13:37:30 2015