How can we output current date and time in cpp? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

How can we output current date and time in cpp?

21st May 2019, 2:25 PM
InfinityAJ
InfinityAJ - avatar
2 Answers
+ 6
https://code.sololearn.com/cq39zBVgvDfX/#cpp #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { time_t currTime = time(NULL); printf("%s", ctime(&currTime)); return 0; }
21st May 2019, 2:41 PM
AgentSmith
+ 8
Thanks AgentSmith
21st May 2019, 3:33 PM
InfinityAJ
InfinityAJ - avatar