Page tree
Skip to end of metadata
Go to start of metadata

The DateTime Service Class

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.

The method DateTime_GetDateAndTime

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:

Parameter Description
DateValue returns the current date in standard form as described above.
TimeValue returns the current local time in standard form as described above.


The method DateTime_JulianToDate

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:

Parameter Description
Julian Specifies the relative Julian value for which the date value is desired.
Day returns the day value, 1..31, of the decomposed date value.
Month returns the month value, 1..12, of the decomposed date value.
Year returns the year value of the decomposed date value.


The method DateTime_ToJulian

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:

Parameter Description
day Specifies the day value of the date.
month Specifies the month value of the date.
year Specifies the year value of the date.

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

  • No labels