GoHacking.com: Ethical Hacking and Cyber Security
Home » C PROGRAMMING

C Program to Get the Current System Date

Submitted by on Wednesday, 16 January 20082 Comments

This program will get or read the current system date from the system. It displays Year, Month and Day.

 
 
 
 
#include <dos.h>
#include <stdio.h>

int main(void)
{
struct date d;
getdate(&d);
printf(“The current year is: %d\n”, d.da_year);
printf(“The current day is: %d\n”, d.da_day);
printf(“The current month is: %d\n”, d.da_mon);
return 0;
}



By using/following this site you agree to our Legal Disclaimer

2 Comments »

  • Gaurav said:

    Thanks a Lot.
    It helped me a Lot.
    THANK YOU..!!! :-)

  • laki said:

    this prog is showing error when i run in DEVC++

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.