Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_dos_getdate() get the system date</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _dos_getdate()          Get the system date

 #include   <dos.h>

  void _dos_getdate(date);
  struct dosdate_t *date;     Location of returned date

    _dos_getdate() uses MS-DOS function 2Ah to obtain the current system
    date. The date is returned in struct dosdate_t, defined in dos.h:

           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)
              }

   Portability:     MS-DOS only, version 1.0 or higher

------------------------------- Example ---------------------------------

 This program prints the system date

           #include <dos.h>

           char *day_of_week[] = { "Sunday", "Monday", "Tuesday",
                                   "Wednesday", "Thursday", "Friday",
                                   "Saturday" };

           main()
           {
              struct dos_date_t date;

              _dos_getdate(&date);
              printf("Today is %s, %d-%d-%d\n", day_of_week[date.dayofweek],
           date.month, date.day, date.year);
           }


See Also: _dos_setdate() _dos_gettime()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson