10 const std::string input =
"2025-12-16T10:20:30.123+02:30";
13 std::cout <<
"Failed to parse input" << std::endl;
17 std::cout <<
"unix_ms: " << dt.
unix_ms() <<
'\n';
19 std::cout <<
"formatted: " << dt.
format(
"%F %T") <<
'\n';
22 std::cout <<
"tomorrow: " << tomorrow.
to_iso8601() <<
'\n';
Represents a moment in time with optional fixed UTC offset.
DateTime start_of_day() const
Start of local day.
IsoWeekDateStruct iso_week_date() const
Local ISO week date.
static bool try_parse_iso8601(const std::string &str, DateTime &out) noexcept
Try to parse ISO8601 string to DateTime.
std::string to_iso8601() const
Format to ISO8601 string with stored offset.
std::string format(const std::string &fmt) const
Format using custom pattern.
std::string to_iso8601_utc() const
Format to ISO8601 string in UTC.
ts_ms_t unix_ms() const noexcept
Access UTC milliseconds.
DateTime add_days(int64_t days) const noexcept
Add days to UTC instant.
int main()
Demonstrates DateTime parsing, formatting, arithmetic, and ISO week-date usage.
std::string format_iso_week_date(const IsoWeekDateStruct &iso_date, bool extended=true, bool include_weekday=true)
Format ISO week date to string.
Main namespace for the Time Shield library.
Structure to represent an ISO week date.
Main header file for the Time Shield library.