1 #include <samchon/library/Datetime.hpp> 4 #include <samchon/WeakString.hpp> 5 #include <samchon/library/StringUtil.hpp> 30 set(year, month, date, hour, min, sec);
55 if (wStr.
find(
" ") == std::string::npos)
58 vector<WeakString> &vec = wStr.
between(
" ").split(
":");
59 int hour = stoi(vec[0].str());
60 int min = stoi(vec[1].str());
64 sec = stoi(vec[2].str());
70 void Datetime::set(
int year,
int month,
int date,
int hour,
int minutes,
int seconds)
73 addSecond( hour*60*60 + minutes*60 + seconds );
163 operator+=(chrono::hours(val));
167 operator+=(chrono::minutes(val));
171 operator+=(chrono::seconds(val));
177 struct tm &tm =
toTM();
182 struct tm &tm =
toTM();
187 struct tm &tm =
toTM();
auto getYear() const -> int
Get year of the Date.
virtual void setDate(int)
virtual void setDate(int)
virtual void addDate(int) override
Add days to the Date.
void setHour(int)
Set hour.
void addMinute(int)
Add minutes.
auto toTM() const -> struct::tm
Converts the Date to struct tm.
auto getHour() const -> int
Get hour.
virtual auto toString() const -> std::string override
Converts the Datetime to std::string.
virtual void addDate(int)
Add days to the Date.
void setSecond(int)
Set hour.
auto getSecond() const -> int
Get second.
auto find(const WeakString &delim, size_t startIndex=NULL) const -> size_t
Finds first occurence in string.
virtual void setYear(int)
Set year of the Date.
auto getDate() const -> int
Get the day in month of the Date.
virtual void addYear(int)
Add years to the Date.
virtual void addWeek(int) override
Add weeks to the Date.
virtual void addYear(int) override
Add years to the Date.
auto getMinute() const -> int
Get minute.
static auto substitute(const std::string &format, const T &val, const _Args &...args) -> std::string
Substitutes "{n}" tokens within the specified string with the respective arguments passed in...
void addHour(int)
Add hours.
void addSecond(int)
Add seconds.
virtual void setMonth(int)
Set month of the Date.
void set(const std::string &)
Setter by string.
virtual void setMonth(int)
Set month of the Date.
virtual void addMonth(int)
Add months to the Date.
void set(const std::string &)
Setter by string.
auto getMonth() const -> int
Get month of the Date.
virtual auto toString() const -> std::string
Converts the Date to std::string.
virtual void addMonth(int) override
Add months to the Date.
virtual void setYear(int)
Set year of the Date.
virtual void addWeek(int)
Add weeks to the Date.
void setMinute(int)
Set minute.
auto between(const WeakString &start={}, const WeakString &end={}) const -> WeakString
Generates a substring.
Top level namespace of products built from samchon.
A string class only references characeters, reference only.