DosGetDateTime

From EDM2
Revision as of 09:24, 12 October 2018 by Ak120 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

DosGetDateTime gets the current date and time.

Syntax

DosGetDateTime ( pdtm )

Parameters

pdtm - PDATETIME - input
Pointer to a DATETIME structure where the date and time information is to be stored.

Returns

This function returns an APIRET with no values.

APIRET  rc
0       NO_ERROR

Define (C/C++)

#define INCL_DOSDATETIME
#include <os2.h>

Export name/Ordinal

DOSCALLS.DLL 230.

Gotchas

The sign of the time zone is opposed to that ordinary used. Ie GMT+1 (Western Europe) <=> -60

Sample Code

PDATETIME  pdtm;
DATETIME   dtm;
APIRET     rc;
...
pdtm = &dtm;
rc = DosGetDateTime (pdtm);
#define INCL_DOSDATETIME 
#include <os2.h> 
#include <stdio.h> /* For printf */ 

DATETIME dt; 
APIRET rc; 

rc=DosGetDateTime(&dt); /* Get current time and date */ 

printf("The time is %d:%d:%d\n", 
      (short)dt.hours, 
      (short)dt.minutes, 
      (short)dt.seconds);

Related Functions