date to string c 2b 2b

Solutions on MaxInterview for date to string c 2b 2b by the best coders in the world

showing results for - "date to string c 2b 2b"
Isabelle
16 Oct 2019
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}
Sakina
12 Feb 2019
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}
23