21 #ifndef ASAP_DATETIME_H 22 #define ASAP_DATETIME_H 31 explicit datetime(time_t time = std::time(
nullptr)) noexcept;
32 explicit datetime(
const std::string &
datetime,
const std::string & format =
"%x %X",
const std::string & locale =
"");
52 std::string
str(
const std::string & fmt =
"%x %X")
const;
85 #endif // ASAP_DATETIME_H int yday() const
Returns the day in a year specified in this asap::datetime.
asap::period until(const asap::datetime &dt) const
Creates an instance of asap::period starting at this datetime and ending at dt.
int minute() const
Returns the minutes of an hour specified in this asap::datetime.
int mday() const
Returns the day of a month specified in this asap::datetime.
int wday() const
Returns the day of a week specified in this asap::datetime.
datetime & operator+=(const seconds &d)
Adds a duration specified in seconds to a datetime.
datetime(time_t time=std::time(nullptr)) noexcept
Constructs a asap::datetime from a time_t, defaulting to the current time.
int second() const
Returns the seconds of a minute specified in this asap::datetime.
asap::datetime afternoon()
Creates a new asap::datetime representing the afternoon of the same day.
asap::seconds operator-(const datetime &other) const
Returns a duration in seconds specifying the difference to another datetime.
int month() const
Returns the month in a year specified in this asap::datetime.
std::string str(const std::string &fmt="%x %X") const
Converts to an string using the format specified.
asap::datetime morning()
Creates a new asap::datetime representing the morning of the same day.
The asap::datetime class exposes methods to create, manipulate and print dates.
The asap::duration class exposes methods to create, manipulate and print durations.
time_t timestamp() const
Converts an asap::datetime to a time_t
The asap::period class is a bound period, with starting and ending dates. Its purpose is to provide d...
asap::datetime midnight()
Creates a new asap::datetime representing the midnight of the same day.
int hour() const
Returns the hours of a day specified in this asap::datetime.
asap::datetime & operator-=(const asap::duration< convert > &c)
Subtracts a duration from this datetime.
int year() const
Returns the year specified in this asap::datetime.