Gets current system date using system call 0x2A.
#include <dos.h>
void _dos_getdate( struct _dosdate_t *date );
date | Current system date |
The _dos_getdate routine uses system call 0x2A to obtain the current system date. The date is returned in a _dosdate_t structure, defined in DOS.H.
The _dosdate_t structure contains the following elements:
Element | Description |
unsigned char day | 1–31 |
unsigned char month | 1–12 |
unsigned int year | 1980–2099 |
unsigned char dayofweek | 0–6 (0 = Sunday) |
None.
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:None
_dos_gettime, _dos_setdate, _dos_settime, gmtime, localtime, mktime, _strdate, _strtime, time
/* DGTIME.C: This program gets and displays current date and time values. */
#include <stdio.h>
#include <dos.h>
void main( void )
{
struct _dosdate_t date;
struct _dostime_t time;
/* Get current date and time values */
_dos_getdate( &date );
_dos_gettime( &time );
printf( “Today's date is %d-%d-%d\n”, date.month, date.day, date.year );
printf( “The time is %02d:%02d\n”, time.hour, time.minute );
}
Today's date is 12-15-1999
The time is 18:07