Skip to content

gmSCDateTimeClass

The service class DateTime obtains the current date and time from the operating system and converts them into a form that can be used for comparisons and arithmetic. In this context date values are stored as Julian days since a specified start date, Dec 31,1967 by default, and time values are stored as seconds since midnight. Note that since time is only expressed in seconds no special operating system calls are needed to obtain it.


Prototype

void DateTime_GetDateAndTime(int* DateValue,int* TimeValue);

The DateTime_GetDateAndTime method obtains the current data and time from the operating system and returns them in standard integer value form. The standard date value is simply the number of days that have passed since a specified start date (see JulianZero). The standard integer value form for time is simply the number of seconds since midnight. Its parameters are as follows:

ParameterDescription
DateValuereturns the current date in standard form as described above.
TimeValuereturns the current local time in standard form as described above.


Prototype

void DateTime_JulianToDate(int Julian,int* Day,int* Month,int* Year);

The DateTime_JulianToDate method converts a relative Julian value into its corresponding date value — day, month, year. The relative Julian value is simply the number of days that have passed since a specified started date (see JulianZero). Its parameters are as follows:

ParameterDescription
JulianSpecifies the relative Julian value for which the date value is desired.
Dayreturns the day value, 1..31, of the decomposed date value.
Monthreturns the month value, 1..12, of the decomposed date value.
Yearreturns the year value of the decomposed date value.


Prototype

int DateTime_ToJulian(int day,int month,int year);

The DateTime_ToJulian method converts a date value into its relative Julian value. The relative Julian value is simply the number of days that have passed since a specified started date (see JulianZero). Its parameters are as follows:

ParameterDescription
daySpecifies the day value of the date.
monthSpecifies the month value of the date.
yearSpecifies the year value of the date.

The method returns the number of days that have passed since the specified start date.