C _dos_getdate() function : C Reference
Gets DOS system date in C Programming :
void _dos_getdate(struct dosdate_t *datep);
dosdate_t Structure and Structure Members :
struct dosdate_t { unsigned char day; /* 1--31 */ unsigned char month; /* 1--12 */ unsigned int year; /* 1980--2099 */ unsigned char dayofweek; /* 0--6; 0 = Sunday */ };
- This structure is used by _dos_getdate() and _dos_setdate() function.
- _dos_getdate fills in the dosdate_t structure *datep with the system’s current date.
C Program to Get/print System Day,Month and year :
#include <dos.h> #include <stdio.h> int main(void) { struct dosdate_t d; _dos_getdate(&d); printf("The current year is: %d\n", d.year); printf("The current day is: %d\n", d.day); printf("The current month is: %d\n", d.month); return 0; }
Output :
The current year is: 2012 The current day is: 18 The current month is: 1