123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <chapter xml:id="date_time.h">
- <title><tt>__vic/date_time.h</tt></title>
- <p>Date and time utilies.</p>
- <chapter xml:id="is_leap_year">
- <title><tt>is_leap_year()</tt></title>
- <code-block lang="C++">
- constexpr bool is_leap_year(int year);
- </code-block>
- <p>Determines if the year is a leap year according to Gregorian calendar.</p>
- </chapter>
- <chapter xml:id="days_in_month">
- <title><tt>days_in_month()</tt></title>
- <code-block lang="C++">
- int days_in_month(int month, int year);
- </code-block>
- <p>Returns number of days in the month. Month is a number from 1 to 12.
- The second parameter is used only if the month is 2 (february), otherwise
- is just ignored.</p>
- </chapter>
- <chapter xml:id="days_between_years">
- <title><tt>days_between_years()</tt></title>
- <code-block lang="C++">
- long days_between_years(unsigned year1, unsigned year2);
- </code-block>
- <p>Returns the difference in days between the beginning of the 2nd year and
- the beginning of the 1st year.</p>
- </chapter>
- <chapter xml:id="invalid_date">
- <title><tt>invalid_date</tt></title>
- <code-block lang="C++">
- class invalid_date; // : public std::exception
- </code-block>
- <p>The exception thrown when the value of the date or time element is
- invalid.</p>
- </chapter>
- <chapter xml:id="validate_date_time">
- <title><tt>validate_date()</tt>, <tt>validate_time()</tt>,
- <tt>validate_date_time()</tt></title>
- <code-block lang="C++">
- void validate_date(int yy, int mm, int dd);
- void validate_time(int hh, int mi, int ss);
- void validate_date_time(int yy, int mm, int dd, int hh, int mi, int ss);
- </code-block>
- <p>Checks if the date/time value is valid. Following constraints are checked:
- </p>
- <list style="bulleted">
- <item><tt>yy</tt> (year) - cannot be <tt>0</tt>,</item>
- <item><tt>mm</tt> (month) - <tt>1..12</tt>,</item>
- <item><tt>dd</tt> (day of the month) - <tt>1..{28..31}</tt>, depending
- on the month,</item>
- <item><tt>hh</tt> (hour) - <tt>0..23</tt>,</item>
- <item><tt>mi</tt> (minute) - <tt>0..59</tt>,</item>
- <item><tt>ss</tt> (second) - <tt>0..59</tt>.</item>
- </list>
- <p><tt>invalid_date</tt> is thrown in case of the constraint violation.</p>
- <note>Specific time values as <tt>24:00:00</tt> (midnight at the end of a
- day) or <tt>59:60</tt> (leap second) are considered as invalid!</note>
- </chapter>
- </chapter>
|