no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | en:docs:fapi:dosgetdatetime [2018/08/31 07:28] – created prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | This call gets the current date and time maintained by the operating system. | ||
+ | |||
+ | ==Syntax== | ||
+ | | ||
+ | |||
+ | ==Parameters== | ||
+ | ;DateTime (PDATETIME) - output : Address of the date and time structure: | ||
+ | ::hours (UCHAR) - Current hour | ||
+ | ::minutes (UCHAR) - Current minute | ||
+ | ::seconds (UCHAR) - Current second | ||
+ | :: | ||
+ | ::day (UCHAR) - Current day | ||
+ | ::month (UCHAR) - Current month | ||
+ | ::year (USHORT) - Current year | ||
+ | ::timezone (SHORT) - Minutes west of UTC (Universal Time Coordinate) | ||
+ | ::weekday (UCHAR) - Current day of the week. Sunday is 0. | ||
+ | |||
+ | ==Return Code== | ||
+ | rc (USHORT) - return | ||
+ | Return code description is: | ||
+ | * 0 NO_ERROR | ||
+ | |||
+ | ==Remarks== | ||
+ | The dayofweek value is based on Sunday equal to zero. The value of timezone is the difference in minutes between the current time zone and UTC. This number is positive if it is earlier than UTC and negative if it is later than UTC. For Eastern Standard Time, this value is 300 (5 hours earlier than UTC). | ||
+ | |||
+ | If the application is executing in the OS/2 environment, | ||
+ | |||
+ | ==Example Code== | ||
+ | ===C Binding=== | ||
+ | <PRE> | ||
+ | typedef struct _DATETIME { /* date */ | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | USHORT | ||
+ | SHORT | ||
+ | UCHAR | ||
+ | } DATETIME; | ||
+ | |||
+ | #define INCL_DOSDATETIME | ||
+ | |||
+ | USHORT | ||
+ | PDATETIME DateTime; | ||
+ | USHORT | ||
+ | </ | ||
+ | This example gets the current time and date. | ||
+ | <PRE> | ||
+ | #define INCL_DOSDATETIME | ||
+ | |||
+ | DATETIME DateBuffer; | ||
+ | USHORT | ||
+ | |||
+ | rc = DosGetDateTime(& | ||
+ | </ | ||
+ | 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. | ||
+ | |||
+ | <PRE> | ||
+ | #define INCL_DOSDATETIME | ||
+ | #include < | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | DATETIME | ||
+ | USHORT | ||
+ | |||
+ | rc = DosGetDateTime(& | ||
+ | printf(" | ||
+ | | ||
+ | DateTime.day = 10; | ||
+ | DateTime.month = 5; | ||
+ | DateTime.year = 1987; | ||
+ | printf(" | ||
+ | | ||
+ | rc = DosSetDateTime(& | ||
+ | printf(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===MASM Binding=== | ||
+ | <PRE> | ||
+ | DATETIME struc | ||
+ | date_hours | ||
+ | date_minutes | ||
+ | date_seconds | ||
+ | date_hundredths db ? ;current hundredths of a second | ||
+ | date_day | ||
+ | date_month | ||
+ | date_year | ||
+ | date_timezone | ||
+ | date_weekday | ||
+ | DATETIME ends | ||
+ | |||
+ | EXTRN DosGetDateTime: | ||
+ | INCL_DOSDATETIME | ||
+ | |||
+ | PUSH@ OTHER | ||
+ | CALL | ||
+ | |||
+ | Returns WORD | ||
+ | </ | ||
+ | |||
+ | ====== Note ====== | ||
+ | |||
+ | Text based on [[http:// | ||
+ | |||
+ | {{page> | ||