POCO C++库学习和分析 -- 日期与时间 (四)

2014-11-24 03:20:57 · 作者: · 浏览: 3
FEBRUARY,
MARCH,
APRIL,
MAY,
JUNE,
JULY,
AUGUST,
SEPTEMBER,
OCTOBER,
NOVEMBER,
DECEMBER
};

enum DaysOfWeek
/// Symbolic names for week day numbers (0 to 6).
{
SUNDAY = 0,
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY
};

DateTime();
/// Creates a DateTime for the current date and time.


DateTime(const Timestamp& timestamp);
/// Creates a DateTime for the date and time given in
/// a Timestamp.

DateTime(int year, int month, int day, int hour = 0, int minute = 0, int


second = 0, int millisecond = 0, int microsecond = 0);
/// Creates a DateTime for the given Gregorian date and time.
/// * year is from 0 to 9999.
/// * month is from 1 to 12.
/// * day is from 1 to 31.
/// * hour is from 0 to 23.
/// * minute is from 0 to 59.
/// * second is from 0 to 59.
/// * millisecond is from 0 to 999.
/// * microsecond is from 0 to 999.


DateTime(double julianDay);
/// Creates a DateTime for the given Julian day.


DateTime(Timestamp::UtcTimeva l utcTime, Timestamp::TimeDiff diff);
/// Creates a DateTime from an UtcTimeva l and a TimeDiff.
///
/// Mainly used internally by DateTime and friends.


DateTime(const DateTime& dateTime);
/// Copy constructor. Creates the DateTime from another one.


~DateTime();
/// Destroys the DateTime.


DateTime& operator = (const DateTime& dateTime);
/// Assigns another DateTime.

DateTime& operator = (const Timestamp& timestamp);
/// Assigns a Timestamp.


DateTime& operator = (double julianDay);
/// Assigns a Julian day.


DateTime& assign(int year, int month, int day, int hour = 0, int minute = 0,


int second = 0, int millisecond = 0, int microseconds = 0);
/// Assigns a Gregorian date and time.
/// * year is from 0 to 9999.
/// * month is from 1 to 12.
/// * day is from 1 to 31.
/// * hour is from 0 to 23.
/// * minute is from 0 to 59.
/// * second is from 0 to 59.
/// * millisecond is from 0 to 999.
/// * microsecond is from 0 to 999.


void swap(DateTime& dateTime);
/// Swaps the DateTime with another one.


int year() const;
/// Returns the year.

int month() const;
/// Returns the month (1 to 12).

int week(int firstDayOfWeek = MONDAY) const;
/// Returns the week number within the year.
/// FirstDayOfWeek should be either SUNDAY (0) or MONDAY (1).
/// The returned week number will be from 0 to 53. Week number 1 is


the week
/// containing January 4. This is in accordance to ISO 8601.
///
/// The following example assumes that firstDayOfWeek is MONDAY. For 2005, which started
/// on a Saturday, week 1 will be the week starting on Monday, January 3.
/// January 1 and 2 will fall within week 0 (or the last week of the previous year).
///
/// For 2007, which starts on a Monday, week 1 will be the week


startung on Monday, January 1.
/// There will be no week 0 in 2007.

int day() const;
/// Returns th