#include <datetime.h>
Inherited by a_util::datetime::DateTime.
|
|
| Date () |
| | Default constructor - initializes the date to 00.00.0000.
|
| |
| | Date (int year, int month, int day) |
| |
| void | set (int year, int month, int day) |
| |
| bool | set (const std::string &date) |
| |
| void | setDay (int day) |
| |
| int | getDay () const |
| |
| void | setMonth (int month) |
| |
| int | getMonth () const |
| |
| void | setYear (int year) |
| |
| int | getYear () const |
| |
| std::string | format (const std::string &format_str) const |
| |
Date implementation representing a date consisting of year, month and day
- Warning
- : This class does not enforce date consistency! E.g. "42.102.20000" is a valid date!
◆ Date()
| a_util::datetime::Date::Date |
( |
int | year, |
|
|
int | month, |
|
|
int | day ) |
Constructor for presetting the stored date.
- Parameters
-
| [in] | year | The year. |
| [in] | month | The month. |
| [in] | day | The day of the month. |
◆ format()
| std::string a_util::datetime::Date::format |
( |
const std::string & | format_str | ) |
const |
Creates a string representation of the stored date.
This format identifiers are supported: a A b B c d H I j m M p S U w W x X y Y Percent signs are escaped by %% %#<character> is not supported because it only makes sense with Z which is also not supported
- Parameters
-
| [in] | format_str | The format of the string representation (see DateTime::format, might be empty). |
- Returns
- A string representation of the stored date.
- Exceptions
-
| std::invalid_argument | If the format string is invalid |
◆ getDay()
| int a_util::datetime::Date::getDay |
( |
| ) |
const |
Get the day of the month.
- Returns
- The day of the month.
◆ getMonth()
| int a_util::datetime::Date::getMonth |
( |
| ) |
const |
Get the month.
- Returns
- The month.
◆ getYear()
| int a_util::datetime::Date::getYear |
( |
| ) |
const |
Get the year.
- Returns
- The year.
◆ set() [1/2]
| bool a_util::datetime::Date::set |
( |
const std::string & | date | ) |
|
Sets the stored date given a date string
This string formats are supported: yyyy.mm.dd or dd.mm.yyyy
-
yyyy Year as decimal number (zero-padded 0000..9999)
-
mm Month as decimal number (zero-padded 01..12)
-
dd Day of month as decimal number (zero-padded 01..31)
-
. Separator for year.month.day or day.month.year
- Parameters
-
| [in] | date | The string contains the given date as string. |
- Returns
false if the date string is invalid, true otherwise
◆ set() [2/2]
| void a_util::datetime::Date::set |
( |
int | year, |
|
|
int | month, |
|
|
int | day ) |
Sets the stored date.
- Parameters
-
| [in] | year | The year. |
| [in] | month | The month. |
| [in] | day | The day of the month. |
◆ setDay()
| void a_util::datetime::Date::setDay |
( |
int | day | ) |
|
Sets the day of the month.
- Parameters
-
| [in] | day | The day of the month. |
◆ setMonth()
| void a_util::datetime::Date::setMonth |
( |
int | month | ) |
|
Set the month.
- Parameters
-
◆ setYear()
| void a_util::datetime::Date::setYear |
( |
int | year | ) |
|
The documentation for this class was generated from the following file: