c 2b 2b string format ctime

Solutions on MaxInterview for c 2b 2b string format ctime by the best coders in the world

showing results for - "c 2b 2b string format ctime"
Corentin
19 Jul 2017
1#include <ctime>
2#include <iostream>
3using namespace std;
4
5int main()
6{
7	time_t curr_time;
8	tm * curr_tm;
9	char date_string[100];
10	char time_string[100];
11	
12	time(&curr_time);
13	curr_tm = localtime(&curr_time);
14	
15	strftime(date_string, 50, "Today is %B %d, %Y", curr_tm);
16	strftime(time_string, 50, "Current time is %T", curr_tm);
17	
18	cout << date_string << endl;
19	cout << time_string << endl;
20	
21	return 0;
22}