nn::fnd::DateTime Class

Header file: nn/fnd.h

Syntax

class DateTime

Description

Indicates a date and time.

Can handle dates and times from 1900/01/01 00:00:00.000 to 2189/12/31 23:59:59.999.

The calendar is Gregorian, calculated from 2000/01/01 (Saturday). Each day is treated as having exactly 86400 seconds.

The DateTime class provides addition and subtraction with the TimeSpan class. You can get a DateTime object as the sum or difference of a DateTime and TimeSpan object. You can get a TimeSpan object as the difference between two DateTime objects. The upper and lower limits for DateTime are configured to prevent overflows in the TimeSpan object obtained as the difference between two DateTime objects.

Member Constants

S MIN_DATETIME const DateTime The oldest (most antiquated) date and time that can be handled by the DateTime class.
S MAX_DATETIME const DateTime The most distant future date and time that can be handled by the DateTime class.

Member Functions

DateTime Creates a DateTime object set to 2000-01-01 00:00:00.000.
GetYear Gets the year.
GetMonth Gets the month.
GetDay Gets the date of the day.
GetWeek Gets the name of the day of the week.
GetHour Gets the hour.
GetMinute Gets the minute.
GetSecond Gets the second.
GetMilliSecond Gets the millisecond.
GetParameters Gets all the year, month, date, hour, minute, and second values.
ReplaceYear Replaces the year.
ReplaceMonth Replaces the month.
ReplaceDay Replaces the day.
ReplaceHour Replaces the hour.
ReplaceMinute Replaces the minute.
ReplaceSecond Replaces the second.
ReplaceMilliSecond Replaces the millisecond.
operator+= The += operator for the DateTime and TimeSpan classes.
operator-= The -= operator for the DateTime and TimeSpan classes.
S FromParameters Generates a DateTime object from a year, month, day, hour, minute, and second value.
S IsValidDate Determines if the date is valid.
S IsValidParameters Determines if the date and time are valid.
S IsLeapYear Determines if the year is a leap year.
S DateToDays Calculates the number of days elapsed from 2000/01/01 until the given date.
S DaysToDate Calculates the date from the given number of days elapsed since 2000/01/01.
S DaysToWeekday Calculates the day of the week from the given number of days elapsed since 2000/01/01.
S GetNow Gets the current date and time.

Friend functions

operator== The == operator between two DateTime classes.
operator!= The != operator between two DateTime classes.
operator< The < operator between two DateTime classes.
operator> The > operator between two DateTime classes.
operator<= The <= operator between two DateTime classes.
operator>= The >= operator between two DateTime classes.
operator+ The + operator for the DateTime and TimeSpan classes.
operator- The - operator for the DateTime and TimeSpan classes.

Revision History

2010/09/15
Added information on addition and subtraction with DateTime and TimeSpan objects. Noted that the values obtained by subtracting two DateTime objects are constrained to the range that can be represented by TimeSpan objects.
2010/01/29
Initial version.

CONFIDENTIAL