|
struct Date : public RelOps< Date, Moveable<Date> >
A simple date object with up to a day precision.
Date()
Default constructor.
Date(const Nuller&)
Construct an empty date.
Date(int y, int m, int d)
Constructs a date based on y m d.
byte day
Day.
byte month
Month.
int16 year
Year.
void Serialize(Stream& s)
Serializes Date to/from s.
bool IsValid() const
Returns true if the date is valid.
void Set(int scalar)
Assign a date that is stored in the numeric scalar.
int Get() const
Converts the time into a numeric value.
int Compare(Date b) const
Compares Date with b, returns -1 if <b, 0 if == b, 1 if > b.
Date& operator++()
Moves to the next day.
Date& operator--()
Moves to the previous day.
static Date Low()
Returns the lowest possible date (year 4000).
static Date High()
Returns the highest possible date (year 4000).
int DayOfWeek(Date date)
Day date number of day of week, beginning from 0.
bool IsLeapYear(int year)
Returns true if year is leap (there is 29 days in February in that year).
int GetDaysOfMonth(int month, int year)
Returns a number of days in month of year.
Date LastDayOfMonth(Date d)
Returns day d last day of the month.
Example:
LastDayOfMonth(Date(2011, 9, 23)) = "30/9/2011"
Date FirstDayOfMonth(Date d)
Returns day d first day of the month.
Example:
LastDayOfYear(Date(2011, 9, 23)) = "1/9/2011"
Date LastDayOfYear(Date d)
Returns day d last day of the year.
Example:
LastDayOfYear(Date(2011, 9, 23)) = "31/12/2011"
Date FirstDayOfYear(Date d)
Returns day d first day of the year.
Example:
FirstDayOfYear(Date(2011, 9, 23)) = "1/1/2011"
int DayOfYear(Date d)
Returns day d number of day of year, beginning from 1.
Example:
DayOfYear(Date(2011, 1, 2)) = 2
Date AddMonths(Date date, int months)
Adds months to date and returns the result.
Date AddYears(Date date, int years)
Adds years to date and returns the result. Note that this is not as simple as adding year attribute of Date because of leap years.
struct Time : public Date, public RelOps< Time, Moveable<Time> >
A simple date time object with up to a second precision.
Time()
Default constructor.
Time(const Nuller&)
Construcs an empty time.
Time(int y, int m, int d, int h = 0, int n = 0, int s = 0)
Constructs a time based on y m d h n s.
Time(FileTime filetime)
Constructs based on a platform specific filetime.
byte hour
Hour.
byte minute
Minute.
byte second
Second.
virtual static Time High()
Returns the highest possible time (year 4000).
virtual static Time Low()
Returns the lowest possible time (year -4000).
void Set(int64 scalar)
Assign a time that is stored in the numeric scalar.
virtual int64 Get() const
Converts the time into a numeric value.
bool IsValid() const
Returns true if Time is valid (Date is valid and hour/minute/second values are in range).
FileTime AsFileTime() const
Converst the time into a system specific value.
|