How to get current date in c | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get current date in c

is there a way to store current system date in a variable in c(any pre defined functions??) if there is ,it would be helpful to know it's syntax too!😇

2nd Aug 2018, 5:36 PM
THE GAMER
THE GAMER - avatar
5 Answers
+ 1
char* chrDate = __DATE__; printf ("%s",chrDate);
2nd Aug 2018, 7:26 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
you can split value of chrDate variable to access dd mm and yyyy.. I hope you will be able to do it.. let me know if you want me to do the same for you
3rd Aug 2018, 5:45 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
thanks,but I need to access dd mm and yyyy separately to find age...
3rd Aug 2018, 4:20 AM
THE GAMER
THE GAMER - avatar
0
yeah,got it.thanks again!
3rd Aug 2018, 8:00 AM
THE GAMER
THE GAMER - avatar