Date/Time class.
More...
#include <datetime.h>
|
| | DateTime () |
| | Constructs a date/time object.
|
| |
| | DateTime (int year, int month, int day, int hour=0, int minute=0, int seconds=0, int nanoseconds=0, TimeZone timezone=utc_timezone) |
| |
| | ~DateTime () |
| |
| DateTime & | add_days (int days) |
| |
| DateTime & | add_months (int months) |
| |
| DateTime & | add_years (int years) |
| |
| unsigned char | get_day () const |
| |
| unsigned int | get_day_of_week () const |
| | Get the day of the week.
|
| |
| int | get_difference_in_days (const DateTime &other) const |
| | Returns the difference in days between two dates. This function is only accurate for the next few millenniums.
|
| |
| unsigned char | get_hour () const |
| |
| unsigned char | get_minutes () const |
| |
| unsigned char | get_month () const |
| | Returns the month number in range 1-12.
|
| |
| unsigned int | get_nanoseconds () const |
| |
| unsigned char | get_seconds () const |
| |
| TimeZone | get_timezone () const |
| |
| unsigned char | get_week () const |
| | Returns the ISO 8601 week number of the date.
|
| |
| unsigned short | get_year () const |
| |
| bool | is_null () const |
| |
| bool | operator!= (const DateTime &other) const |
| |
| bool | operator< (const DateTime &other) const |
| |
| bool | operator<= (const DateTime &other) const |
| |
| bool | operator== (const DateTime &other) const |
| |
| bool | operator> (const DateTime &other) const |
| |
| bool | operator>= (const DateTime &other) const |
| |
| void | set_date (int year, int month, int day, int hour=0, int minute=0, int seconds=0, int nanoseconds=0, TimeZone timezone=utc_timezone) |
| |
| void | set_day (int day) |
| |
| void | set_hour (int hour) |
| |
| void | set_minutes (int minutes) |
| |
| void | set_month (int month) |
| |
| void | set_nanoseconds (int nanoseconds) |
| |
| void | set_null () |
| |
| void | set_seconds (int seconds) |
| |
| void | set_timezone (TimeZone timezone) |
| |
| void | set_year (int year) |
| |
| DateTime | to_local () const |
| |
| std::string | to_long_date_string () const |
| | Mon Mar 3 2007.
|
| |
| std::string | to_long_time_string () const |
| | hh:mm:ss
|
| |
| std::string | to_short_date_string () const |
| | yyyy-mm-dd
|
| |
| std::string | to_short_datetime_string () const |
| | yyyy-mm-dd hh:mm:ss
|
| |
| std::string | to_short_time_string () const |
| | hh:mm
|
| |
| std::string | to_string () const |
| | Mon Feb 3 12:32:54 2008.
|
| |
| int64_t | to_ticks () const |
| | Converts the date to the number of 100-nanosecond intervals since January 1, 1601 UTC.
|
| |
| DateTime | to_utc () const |
| |
◆ TimeZone
| Enumerator |
|---|
| local_timezone | |
| utc_timezone | |
◆ DateTime() [1/2]
| clan::DateTime::DateTime |
( |
| ) |
|
Constructs a date/time object.
◆ DateTime() [2/2]
| clan::DateTime::DateTime |
( |
int | year, |
|
|
int | month, |
|
|
int | day, |
|
|
int | hour = 0, |
|
|
int | minute = 0, |
|
|
int | seconds = 0, |
|
|
int | nanoseconds = 0, |
|
|
TimeZone | timezone = utc_timezone ) |
◆ ~DateTime()
| clan::DateTime::~DateTime |
( |
| ) |
|
◆ add_days()
| DateTime & clan::DateTime::add_days |
( |
int | days | ) |
|
◆ add_months()
| DateTime & clan::DateTime::add_months |
( |
int | months | ) |
|
◆ add_years()
| DateTime & clan::DateTime::add_years |
( |
int | years | ) |
|
◆ from_short_date_string()
| static DateTime clan::DateTime::from_short_date_string |
( |
const std::string & | value | ) |
|
|
static |
◆ get_current_local_time()
| static DateTime clan::DateTime::get_current_local_time |
( |
| ) |
|
|
static |
Get current system time in local time zone.
◆ get_current_utc_time()
| static DateTime clan::DateTime::get_current_utc_time |
( |
| ) |
|
|
static |
Get current system time in UTC.
◆ get_day()
| unsigned char clan::DateTime::get_day |
( |
| ) |
const |
◆ get_day_of_week()
| unsigned int clan::DateTime::get_day_of_week |
( |
| ) |
const |
Get the day of the week.
- Returns
- 0 = Sunday ... 6 = Saturday
◆ get_days_in_month()
| static int clan::DateTime::get_days_in_month |
( |
int | month, |
|
|
int | year ) |
|
static |
Returns the number of days in the given month.
- Returns
- number of days: 28-31.
◆ get_difference_in_days()
| int clan::DateTime::get_difference_in_days |
( |
const DateTime & | other | ) |
const |
Returns the difference in days between two dates. This function is only accurate for the next few millenniums.
- Returns
- Number of days between dates. Returns a negative value if 'other' is before 'this'.
◆ get_hour()
| unsigned char clan::DateTime::get_hour |
( |
| ) |
const |
◆ get_local_time_from_ticks()
| static DateTime clan::DateTime::get_local_time_from_ticks |
( |
int64_t | ticks | ) |
|
|
static |
Converts a time tick value (number of 100-nanosecond intervals since January 1, 1601 UTC) to a date time in the local time zone.
◆ get_minutes()
| unsigned char clan::DateTime::get_minutes |
( |
| ) |
const |
◆ get_month()
| unsigned char clan::DateTime::get_month |
( |
| ) |
const |
Returns the month number in range 1-12.
- Returns
- 1 = Jan ... 12 = December
◆ get_nanoseconds()
| unsigned int clan::DateTime::get_nanoseconds |
( |
| ) |
const |
◆ get_seconds()
| unsigned char clan::DateTime::get_seconds |
( |
| ) |
const |
◆ get_timezone()
| TimeZone clan::DateTime::get_timezone |
( |
| ) |
const |
◆ get_utc_time_from_ticks()
| static DateTime clan::DateTime::get_utc_time_from_ticks |
( |
int64_t | ticks | ) |
|
|
static |
Converts a time tick value (number of 100-nanosecond intervals since January 1, 1601 UTC) to a date time in UTC.
◆ get_week()
| unsigned char clan::DateTime::get_week |
( |
| ) |
const |
Returns the ISO 8601 week number of the date.
- Returns
- Week number: 1-53.
◆ get_year()
| unsigned short clan::DateTime::get_year |
( |
| ) |
const |
◆ is_null()
| bool clan::DateTime::is_null |
( |
| ) |
const |
◆ operator!=()
| bool clan::DateTime::operator!= |
( |
const DateTime & | other | ) |
const |
◆ operator<()
| bool clan::DateTime::operator< |
( |
const DateTime & | other | ) |
const |
◆ operator<=()
| bool clan::DateTime::operator<= |
( |
const DateTime & | other | ) |
const |
◆ operator==()
| bool clan::DateTime::operator== |
( |
const DateTime & | other | ) |
const |
◆ operator>()
| bool clan::DateTime::operator> |
( |
const DateTime & | other | ) |
const |
◆ operator>=()
| bool clan::DateTime::operator>= |
( |
const DateTime & | other | ) |
const |
◆ set_date()
| void clan::DateTime::set_date |
( |
int | year, |
|
|
int | month, |
|
|
int | day, |
|
|
int | hour = 0, |
|
|
int | minute = 0, |
|
|
int | seconds = 0, |
|
|
int | nanoseconds = 0, |
|
|
TimeZone | timezone = utc_timezone ) |
◆ set_day()
| void clan::DateTime::set_day |
( |
int | day | ) |
|
◆ set_hour()
| void clan::DateTime::set_hour |
( |
int | hour | ) |
|
◆ set_minutes()
| void clan::DateTime::set_minutes |
( |
int | minutes | ) |
|
◆ set_month()
| void clan::DateTime::set_month |
( |
int | month | ) |
|
◆ set_nanoseconds()
| void clan::DateTime::set_nanoseconds |
( |
int | nanoseconds | ) |
|
◆ set_null()
| void clan::DateTime::set_null |
( |
| ) |
|
◆ set_seconds()
| void clan::DateTime::set_seconds |
( |
int | seconds | ) |
|
◆ set_timezone()
| void clan::DateTime::set_timezone |
( |
TimeZone | timezone | ) |
|
◆ set_year()
| void clan::DateTime::set_year |
( |
int | year | ) |
|
◆ to_local()
| DateTime clan::DateTime::to_local |
( |
| ) |
const |
◆ to_long_date_string()
| std::string clan::DateTime::to_long_date_string |
( |
| ) |
const |
◆ to_long_time_string()
| std::string clan::DateTime::to_long_time_string |
( |
| ) |
const |
◆ to_short_date_string()
| std::string clan::DateTime::to_short_date_string |
( |
| ) |
const |
◆ to_short_datetime_string()
| std::string clan::DateTime::to_short_datetime_string |
( |
| ) |
const |
◆ to_short_time_string()
| std::string clan::DateTime::to_short_time_string |
( |
| ) |
const |
◆ to_string()
| std::string clan::DateTime::to_string |
( |
| ) |
const |
◆ to_ticks()
| int64_t clan::DateTime::to_ticks |
( |
| ) |
const |
Converts the date to the number of 100-nanosecond intervals since January 1, 1601 UTC.
◆ to_utc()
| DateTime clan::DateTime::to_utc |
( |
| ) |
const |
The documentation for this class was generated from the following file: