[Toc][Index]

DosGetDateTime



typedef struct _DATETIME {  /* date */
 
  UCHAR   hours;            /* current hour */
  UCHAR   minutes;          /* current minute */
  UCHAR   seconds;          /* current second */
  UCHAR   hundredths;       /* current hundredths of a second */
  UCHAR   day;              /* current day */
  UCHAR   month;            /* current month */
  USHORT  year;             /* current year */
  SHORT   timezone;         /* minutes of time west of UTC */
  UCHAR   weekday;          /* current day of week */
 
} DATETIME;

#define INCL_DOSDATETIME

USHORT  rc = DosGetDateTime(DateTime);

PDATETIME        DateTime;      /* Address of date/time structure
                                    (returned) */

USHORT           rc;            /* return code */

Example 
This example gets the current time and date. 

#define INCL_DOSDATETIME

DATETIME DateBuffer;
USHORT   rc;

   rc = DosGetDateTime(&DateBuffer);        /* Date/Time structure */

The following example obtains and prints date and time information. It 
then changes the system date to 5/10/1987 and prints the updated 
information. 

#define INCL_DOSDATETIME

#include <os2.h>

main()
{
  DATETIME   DateTime;       /* Structure to hold date/time info. */
  USHORT     rc;

  rc = DosGetDateTime(&DateTime);     /* Address of d/t structure */
  printf("Today is %d-%d-%d; the time is %d:%d\n", DateTime.month,
         DateTime.day, DateTime.year, DateTime.hours, DateTime.minutes);
  DateTime.day = 10;
  DateTime.month = 5;
  DateTime.year = 1987;
  printf("The new date is %d-%d-%d; the time is %d:%d\n", DateTime.month,
         DateTime.day, DateTime.year, DateTime.hours, DateTime.minutes);
  rc = DosSetDateTime(&DateTime);    /* Address of d/t structure */
  printf("rc is %d\n", rc);
 }


Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs