rubidium@9825: /* $Id$ */ rubidium@9825: truebrain@9829: /** @file ai_date.hpp Everything to query and manipulate date related information. */ rubidium@9825: rubidium@9825: #ifndef AI_DATE_HPP rubidium@9825: #define AI_DATE_HPP rubidium@9825: rubidium@9825: #include "ai_object.hpp" rubidium@9825: rubidium@9825: /** rubidium@9825: * Class that handles all date related (calculation) functions. rubidium@9825: * rubidium@9825: * @note Months and days of month are 1-based; the first month of the rubidium@9825: * year is 1 and the first day of the month is also 1. rubidium@9825: * @note Years are zero based; they start with the year 0. rubidium@9825: * @note Dates can be used to determine the number of days between rubidium@9825: * two different moments in time because they count the number rubidium@9825: * of days since the year 0. rubidium@9825: */ rubidium@9825: class AIDate : public AIObject { rubidium@9825: public: rubidium@9825: static const char *GetClassName() { return "AIDate"; } rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the current date. rubidium@9825: * This is the number of days since epoch under the assumption that truebrain@9835: * there is a leap year every 4 years, except when dividable by truebrain@9835: * 100 but not by 400. truebrain@9835: * @return The current date. rubidium@9825: */ rubidium@9825: static int32 GetCurrentDate(); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the year of the given date. truebrain@9835: * @param date The date to get the year of. truebrain@9835: * @return The year. rubidium@9825: */ rubidium@9825: static int32 GetYear(int32 date); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the month of the given date. truebrain@9835: * @param date The date to get the month of. truebrain@9835: * @return The month. rubidium@9825: */ rubidium@9825: static int32 GetMonth(int32 date); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the day (of the month) of the given date. truebrain@9835: * @param date The date to get the day of. truebrain@9835: * @return The day. rubidium@9825: */ rubidium@9825: static int32 GetDayOfMonth(int32 date); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the date given a year, month and day of month. truebrain@9835: * @param year The year of the to-be determined date. truebrain@9835: * @param month The month of the to-be determined date. truebrain@9835: * @param day_of_month The day of month of the to-be determined date. truebrain@9835: * @return The date. rubidium@9825: */ rubidium@9825: static int32 GetDate(int32 year, int32 month, int32 day_of_month); rubidium@9825: }; rubidium@9825: rubidium@9825: #endif /* AI_DATE_HPP */