C Program to Print Current Date and Time on Command Line

In this article, We can execute the script of “C Program to Print Current Date and Time on Command Line”. Shall we start the program execution below? Let’s go.

C Program to Print Current Date and Time on Command Line

C Program to Print Current Date and Time on Command Line

Program Code

#include <stdio.h>
#include <conio.h>
#include <dos.h>
int main()
{
   struct date d;

   getdate(&d);

   printf("Current system date: %d/%d/%d", d.da_day, d.da_mon, d.da_year);
   getch();
   return 0;
}

Conclusion

We hope this article helps you to know about “Print Current Date and Time on Command Line Using C Program”. If you have any doubts about this topic then please let us know via the comment section. We will help you. Share this article with other C/C++ developers.

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment