|
Samchon Framework for CPP
1.0.0
|
Date (year, month, day in month) More...
#include <Date.hpp>
Public Member Functions | |
| Date () | |
| Default Constructor. More... | |
| Date (const super &date) | |
| Copy Constructor. More... | |
| Date (super &&date) | |
| Date (int year, int month, int date, int hour=0, int min=0, int sec=0) | |
| Construct from date elements. More... | |
| Date (const std::string &str) | |
| Construct from string. More... | |
| Date (long long linuxTime) | |
| Construct from linux_time. More... | |
| void | set (const WeakString &wstr) |
| Setter by string. More... | |
| void | set (int year, int month, int date, int hour=0, int min=0, int sec=0) |
| Setter by elements of date. More... | |
| void | set (long long linuxTime) |
| Setter by linux_time. More... | |
| auto | getYear () const -> int |
| Get year of the Date. More... | |
| auto | getMonth () const -> int |
| Get month of the Date. More... | |
| auto | getDate () const -> int |
| Get the day in month of the Date. More... | |
| auto | getDay () const -> int |
| Get the day in week of the Date. More... | |
| auto | getHour () const -> int |
| Get hour. More... | |
| auto | getMinute () const -> int |
| Get minute. More... | |
| auto | getSecond () const -> int |
| Get second. More... | |
| void | setYear (int year) |
| Set year of the Date. More... | |
| void | setMonth (int month) |
| Set month of the Date. More... | |
| void | setDate (int val) |
| void | setHour (int val) |
| Set hour. More... | |
| void | setMinute (int val) |
| Set minute. More... | |
| void | setSecond (int val) |
| Set hour. More... | |
| void | addYear (int val) |
| Add years to the Date. More... | |
| void | addMonth (int val) |
| Add months to the Date. More... | |
| void | addWeek (int val) |
| Add weeks to the Date. More... | |
| void | addDate (int val) |
| Add days to the Date. More... | |
| void | addHour (int val) |
| Add hours. More... | |
| void | addMinute (int val) |
| Add minutes. More... | |
| void | addSecond (int val) |
| Add seconds. More... | |
| auto | toTM () const -> struct::tm |
| Converts the Date to struct tm. More... | |
| auto | toLinuxTime () const -> long long |
| Converts the Date to linux_time. More... | |
| auto | toString () const -> std::string |
| Converts the Date to std::string. More... | |
Static Private Member Functions | |
| static auto | calc_seconds (int year, int month, int date) -> long long |
| Calculates how many seconds have flowen since 0000-01-01 00:00:00. More... | |
| static auto | calc_last_dates (int year) -> std::array< int, 12 > |
| Calculates and gets an array of final date of each month for that year. More... | |
Date (year, month, day in month)
Date class is a chrono::time_point<std::chrono::system_clock>.
Date represents the date with year, month and day in month. The basic date (local time) is from your operating system.
A time_point object expresses a point in time relative to a clock's epoch.
Internally, the object stores an object of a duration type, and uses the Clock type as a reference for its epoch.
Referenced comments of std::chrono::time_point
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestaticprivate |
Calculates how many seconds have flowen since 0000-01-01 00:00:00.
This static method is used for calculate the linux_time (since 1970-01-01 09:00:00)
Definition at line 50 of file Date.hpp.
References calc_last_dates().
Referenced by set().


|
inlinestaticprivate |
Calculates and gets an array of final date of each month for that year.
| year | The target year |
Definition at line 74 of file Date.hpp.
Referenced by addMonth(), calc_seconds(), set(), and setMonth().

|
inline |
Setter by string.
| str | Y-m-d |
| invalid_argument | month or date is invalid. |
Definition at line 165 of file Date.hpp.
References samchon::WeakString::between(), samchon::WeakString::find(), samchon::WeakString::split(), and samchon::WeakString::substr().

|
inline |
Setter by elements of date.
| year | ex) 2015 |
| month | January to December. 1 ~ 12 |
| date | day in month. 1 ~ 31 |
| invalid_argument | month or date is invalid. |
Definition at line 206 of file Date.hpp.
References calc_last_dates(), and calc_seconds().

|
inline |
|
inline |
Get year of the Date.
Definition at line 246 of file Date.hpp.
References toTM().
Referenced by addMonth(), addYear(), setDate(), and setMonth().


|
inline |
|
inline |
Get the day in month of the Date.
Definition at line 268 of file Date.hpp.
References toTM().
Referenced by addMonth(), setMonth(), and setYear().


|
inline |
|
inline |
|
inline |
Get minute.
Definition at line 301 of file Date.hpp.
References toTM().
Referenced by setMinute().


|
inline |
Get second.
Definition at line 312 of file Date.hpp.
References toTM().
Referenced by setSecond().


|
inline |
Set year of the Date.
If previous date is leaf month's expiration date and target year what you want is not leaf, the date will be 28
| val | Target year |
Definition at line 333 of file Date.hpp.
References getDate(), and getMonth().
Referenced by addYear().


|
inline |
Set month of the Date.
If the expiration date of the month will be shrinked, the date will be changed to the expiration date
| val | Target month (1 - 12) |
| invalid_argument | month is out of range |
Definition at line 365 of file Date.hpp.
References calc_last_dates(), getDate(), and getYear().

|
inline |
Set date of the Date
| val | Target day in month |
| invalid_argument | When date is over expiration date in month |
Definition at line 390 of file Date.hpp.
References getMonth(), and getYear().

|
inline |
|
inline |
Set minute.
| val | Target minute (0 - 59) |
| invalid_argument | When minute is out of range |
Definition at line 412 of file Date.hpp.
References addMinute(), and getMinute().

|
inline |
Set hour.
| val | Target second (0 - 59) |
| invalid_argument | When second is out of range |
Definition at line 423 of file Date.hpp.
References addSecond(), and getSecond().

|
inline |
|
inline |
Add months to the Date.
Not a matter to val is over 12. If the month is over 12, then years will be added.
| val | Months to add |
Definition at line 452 of file Date.hpp.
References calc_last_dates(), getDate(), getMonth(), and getYear().

|
inline |
|
inline |
Add days to the Date.
Not a matter that val is too huge. If the adding dates derives modification in month or year, then it will be.
| val | Days to add |
Definition at line 499 of file Date.hpp.
References addHour().
Referenced by addWeek().


|
inline |
Add hours.
It's same with operator+=(chrono::hours(val))
Do not worry about the out of range of the hour(val) Parent items like date, month and years will be adjusted automatically.
| val | hours to add |
Definition at line 515 of file Date.hpp.
Referenced by addDate(), and setHour().

|
inline |
Add minutes.
| val | minutes to add |
Definition at line 531 of file Date.hpp.
Referenced by setMinute().

|
inline |
Add seconds.
| val | seconds to add |
Definition at line 548 of file Date.hpp.
Referenced by setSecond().

|
inline |
Converts the Date to struct tm.
Definition at line 561 of file Date.hpp.
Referenced by getDate(), getDay(), getHour(), getMinute(), getMonth(), getSecond(), getYear(), and toString().

|
inline |
Converts the Date to linux_time.
Definition at line 575 of file Date.hpp.
Referenced by samchon::protocol::WebServer::WebServer().

|
inline |