Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:docs:fapi:dosgetdatetime [2021/08/20 03:44] – prokushev | en:docs:fapi:dosgetdatetime [2021/12/05 09:57] (current) – prokushev | ||
---|---|---|---|
Line 5: | Line 5: | ||
This call gets the current date and time maintained by the operating system. | This call gets the current date and time maintained by the operating system. | ||
- | ==Syntax== | + | ===== Syntax ===== |
- | | + | |
- | ==Parameters== | + | <code c> |
- | ;DateTime (PDATETIME) - output : Address of the date and time structure: | + | DosGetDateTime (DateTime) |
- | ::hours (UCHAR) - Current hour | + | </ |
- | ::minutes (UCHAR) - Current minute | + | |
- | ::seconds (UCHAR) - Current second | + | ===== Parameters ===== |
- | ::hundredths (UCHAR) - Current hundredth of a 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== | ||
- | rc (USHORT) - return | ||
Return code description is: | Return code description is: | ||
- | * 0 NO_ERROR | ||
- | ==Remarks== | + | * 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). | 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, | + | If the application is executing in the OS/2 environment, |
+ | |||
+ | ===== Example Code ===== | ||
- | ==Example Code== | + | ==== C Binding |
- | ===C Binding=== | + | |
+ | <code c> | ||
typedef struct _DATETIME { /* date */ | typedef struct _DATETIME { /* date */ | ||
UCHAR | UCHAR | ||
Line 50: | Line 60: | ||
PDATETIME DateTime; | PDATETIME DateTime; | ||
USHORT | USHORT | ||
+ | |||
+ | </ | ||
This example gets the current time and date. | This example gets the current time and date. | ||
+ | <code c> | ||
#define INCL_DOSDATETIME | #define INCL_DOSDATETIME | ||
| | ||
Line 59: | Line 72: | ||
| | ||
rc = DosGetDateTime(& | 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. | 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. | ||
+ | <code c> | ||
#define INCL_DOSDATETIME | #define INCL_DOSDATETIME | ||
#include < | #include < | ||
Line 81: | Line 96: | ||
printf(" | printf(" | ||
} | } | ||
+ | </ | ||
- | ===MASM Binding=== | + | ==== MASM Binding |
+ | <code asm> | ||
DATETIME struc | DATETIME struc | ||
date_hours | date_hours | ||
Line 101: | Line 118: | ||
PUSH@ OTHER | PUSH@ OTHER | ||
CALL | CALL | ||
+ | </ | ||
Returns WORD | Returns WORD | ||
- | + | ===== Note ===== | |
- | ====== Note ====== | + | |
Text based on [[http:// | Text based on [[http:// |