dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosSetDateTime (1.2)
Function Group                                      Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSDATETIME
 
USHORT DosSetDateTime(pdateTime)
PDATETIME pdateTime;    /* pointer to structure for date and time */
 
The DosSetDateTime function sets the current date and time. Although MS OS/2
maintains the current date and time, any process can change the date and
time by using the DosSetDateTime function.
 
The DosSetDateTime function is a family API function.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
pdateTime  Points to the structure that contains the date and time
           information.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
 
     ERROR_TS_DATETIME
 
Example
 
This example retrieves the current date and time and then calls the
DosSetDateTime function to change the month to September and the day to the
26th:
 
DATETIME dateTime;
DosGetDateTime(&dateTime);    /* gets the current date and time */
dateTime.month = 9;           /* changes the month              */
dateTime.day = 26;            /* changes the day                */
DosSetDateTime(&dateTime);    /* sets the new date and time     */
 
See Also
 
DosGetDateTime, DATETIME