Date/Time
The omni::chrono::date_time class can be used to represent a date/time value as 100-nanosecond ticks that have elapsed since 1/1/0001 12:00am with a maximum value of 12/31/9999 23:59:59.9999999.

To get the current time you can simply call omni::chrono::date_time::now() which represents the current date/time in a local format; if you wish to get the date/time in UTC, you can call omni::chrono::date_time::utc_now() to get a UTC date/time object.

class
{
    OMNI_EXPLICIT date_time(uint64_t ticks);
    date_time(uint64_t ticks, const omni::chrono::date_time_kind& kind);
    date_time(uint16_t year, uint8_t month, uint8_t day);
    date_time(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second);
    date_time(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, const omni::chrono::date_time_kind& kind);
    date_time(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond);
    date_time(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, const omni::chrono::date_time_kind& kind);
    ~date_time();
    
    omni::chrono::date_time omni::chrono::date_time::add(const omni::chrono::time_span& value);
    omni::chrono::date_time omni::chrono::date_time::add_days(double value);
    omni::chrono::date_time omni::chrono::date_time::add_hours(double value);
    omni::chrono::date_time omni::chrono::date_time::add_milliseconds(double value);
    omni::chrono::date_time omni::chrono::date_time::add_minutes(double value);
    omni::chrono::date_time omni::chrono::date_time::add_months(int32_t months);
    omni::chrono::date_time omni::chrono::date_time::add_seconds(double value);
    omni::chrono::date_time omni::chrono::date_time::add_ticks(int64_t value);
    omni::chrono::date_time omni::chrono::date_time::add_years(int16_t value);
    bool omni::chrono::date_time::is_dst() const;
    int64_t omni::chrono::date_time::to_binary() const;
    omni::chrono::date_time omni::chrono::date_time::date() const;
    uint8_t omni::chrono::date_time::day() const;
    omni::chrono::day_of_week omni::chrono::date_time::day_of_week() const;
    uint16_t omni::chrono::date_time::day_of_year() const;
    int32_t omni::chrono::date_time::hash_code() const;
    uint8_t omni::chrono::date_time::hour() const;
    omni::chrono::date_time_kind omni::chrono::date_time::kind() const;
    uint16_t omni::chrono::date_time::millisecond() const;
    uint8_t omni::chrono::date_time::minute() const;
    uint8_t omni::chrono::date_time::month() const;
    uint8_t omni::chrono::date_time::second() const;
    uint64_t omni::chrono::date_time::ticks() const;
    omni::chrono::time_span omni::chrono::date_time::time_of_day() const;
    uint16_t omni::chrono::date_time::year() const;
    omni::chrono::time_span omni::chrono::date_time::subtract(const omni::chrono::date_time& value) const;
    omni::chrono::date_time omni::chrono::date_time::subtract(const omni::chrono::time_span& value) const;
    double omni::chrono::date_time::to_oa_date() const;
    uint64_t omni::chrono::date_time::to_file_time() const;
    uint64_t omni::chrono::date_time::to_file_time_utc() const;
    omni::chrono::date_time omni::chrono::date_time::to_local_time() const;
    std::string omni::chrono::date_time::to_string(const std::string& format) const;
    omni::chrono::date_time omni::chrono::date_time::to_utc()
    omni::sequence::string_t omni::chrono::date_time::get_date_time_formats() const;
    omni::sequence::string_t omni::chrono::date_time::get_date_time_formats(char format) const;
    omni::chrono::date_time& operator=(const omni::chrono::date_time& ap);
    omni::chrono::date_time operator+(const omni::chrono::time_span& t);
    omni::chrono::date_time operator-(const omni::chrono::time_span& t);
    omni::chrono::date_time& operator+=(const omni::chrono::time_span& t);
    omni::chrono::date_time& operator-=(const omni::chrono::time_span& t);
    omni::chrono::time_span operator+(const omni::chrono::date_time& d2);
    omni::chrono::time_span operator-(const omni::chrono::date_time& d2);
    bool operator==(const omni::chrono::date_time& d2) const;
    bool operator!=(const omni::chrono::date_time& d2) const;
    bool operator<(const omni::chrono::date_time& d2) const;
    bool operator<=(const omni::chrono::date_time& d2) const;
    bool operator>(const omni::chrono::date_time& d2) const;
    bool operator>=(const omni::chrono::date_time& d2) const;
    
    static omni::chrono::date_time min_value()
    {
        return omni::chrono::date_time();
    }

    static omni::chrono::date_time max_value()
    {
        return omni::chrono::date_time(OMNI_TICKS_TO_10000AD, omni::chrono::date_time_kind::UNSPECIFIED);
    }

    static uint16_t days_in_month(uint16_t year, uint8_t month);
    static omni::chrono::date_time from_binary(int64_t date_data);
    static omni::chrono::date_time from_file_time(int64_t file_time);
    static omni::chrono::date_time from_file_time_utc(int64_t file_time);
    static omni::chrono::date_time from_oa_date(double d);
    static omni::chrono::date_time from_offset(const omni::chrono::date_time& other, const omni::chrono::span_t& offset);
    static omni::chrono::date_time from_offset(const omni::chrono::date_time& other, const omni::chrono::span_t& offset, const omni::chrono::date_time_kind& kind);
    static omni::chrono::date_time from_offset(uint64_t ticks, const omni::chrono::span_t& offset);
    static omni::chrono::date_time from_offset(uint64_t ticks, const omni::chrono::span_t& offset, const omni::chrono::date_time_kind& kind);
    static omni::chrono::date_time from_offset(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, const omni::chrono::span_t& offset);
    static omni::chrono::date_time from_offset(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, const omni::chrono::span_t& offset, const omni::chrono::date_time_kind& kind);
    static omni::chrono::date_time from_offset(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, const omni::chrono::span_t& offset);
    static omni::chrono::date_time from_offset(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, const omni::chrono::span_t& offset, const omni::chrono::date_time_kind& kind);
    static double offset_from_utc();
    static omni::chrono::date_time specify_kind(const omni::chrono::date_time& value, const omni::chrono::date_time_kind& kind);
    static omni::chrono::date_time now();
    static omni::chrono::date_time utc_now();
    static omni::chrono::date_time today();
    static bool is_leap_year(uint16_t year);
    static omni::chrono::date_time parse(const std::string& s);
    static omni::chrono::date_time parse_exact(const std::string& s, const std::string& format);
    static bool try_parse(const std::string& s, omni::chrono::date_time& result);
    static bool try_parse_exact(const std::string& s, const std::string& format, const omni::chrono::date_time_styles& style, omni::chrono::date_time& result);
};

uint16_t omni::chrono::days_in_month(uint16_t year, uint8_t month)
omni::chrono::date_time omni::chrono::from_binary(int64_t date_data)
omni::chrono::date_time omni::chrono::from_file_time(int64_t file_time)
omni::chrono::date_time omni::chrono::from_file_time_utc(int64_t file_time)
omni::chrono::date_time omni::chrono::from_oa_date(double d)
omni::chrono::date_time omni::chrono::specify_kind(const omni::chrono::date_time& value, const omni::chrono::date_time_kind& kind)
omni::chrono::date_time omni::chrono::now()
omni::chrono::date_time omni::chrono::utc_now()
omni::chrono::date_time omni::chrono::today()
bool omni::chrono::is_leap_year(uint16_t year)



Date/Time Utility Functions

You can get various things here.

Example
#include <omnilib>

static void o(const omni::chrono::date_time& dt, const char* fmt)
{
    try {
        std::cout << fmt << " = " << dt.to_string(fmt) << std::endl;
    } catch (...) {
        std::cout << "Invalid format: '" << fmt << "'" << std::endl;
    }
}

static void date_format(const omni::chrono::date_time& dt)
{
    std::cout << "--formatted strings--" << std::endl;
    o(dt, "yyyyMMdd hh:mm:ss tt z");

    o(dt, "d"); // The day of the month, from 1 to 31.
    o(dt, "dd"); // The day of the month, from 01 to 31.
    o(dt, "ddd"); // The abbreviated name of the day of the week.
    o(dt, "dddd"); // The full name of the day of the week.
    o(dt, "f"); // The tenths of a second in a date and time value.
    o(dt, "ff"); // The hundredths of a second in a date and time value.
    o(dt, "fff"); // The milliseconds in a date and time value.
    o(dt, "ffff"); // The ten thousandths of a second in a date and time value.
    o(dt, "fffff"); // The hundred thousandths of a second in a date and time value.
    o(dt, "ffffff"); // The millionths of a second in a date and time value.
    o(dt, "fffffff"); // The ten millionths of a second in a date and time value.
    o(dt, "F"); // If non-zero, the tenths of a second in a date and time value.
    o(dt, "FF"); // If non-zero, the hundredths of a second in a date and time value.
    o(dt, "FFF"); // If non-zero, the milliseconds in a date and time value.
    o(dt, "FFFF"); // If non-zero, the ten thousandths of a second in a date and time value.
    o(dt, "FFFFF"); // If non-zero, the hundred thousandths of a second in a date and time value.
    o(dt, "FFFFFF"); // If non-zero, the millionths of a second in a date and time value.
    o(dt, "FFFFFFF"); // If non-zero, the ten millionths of a second in a date and time value.
    o(dt, "g"); // short-hand
    o(dt, "gg"); // The period or era (e.g. A.D.).
    o(dt, "h"); // The hour, using a 12-hour clock from 1 to 12.
    o(dt, "hh"); // The hour, using a 12-hour clock from 01 to 12.
    o(dt, "H"); // The hour, using a 24-hour clock from 0 to 23.
    o(dt, "HH"); // The hour, using a 24-hour clock from 00 to 23.
    o(dt, "K"); // Time zone information.
    o(dt, "m"); // The minute, from 0 to 59.
    o(dt, "mm"); // The minute, from 00 to 59.
    o(dt, "M"); // The month, from 1 to 12.
    o(dt, "MM"); // The month, from 01 to 12.
    o(dt, "MMM"); // The abbreviated name of the month.
    o(dt, "MMMM"); // The full name of the month.
    o(dt, "s"); // The second, from 0 to 59.
    o(dt, "ss"); // The second, from 00 to 59.
    o(dt, "t"); // The first character of the AM/PM designator.
    o(dt, "tt"); // The AM/PM designator.
    o(dt, "y"); // The year, from 0 to 99.
    o(dt, "yy"); // The year, from 00 to 99.
    o(dt, "yyy"); // The year, with a minimum of three digits.
    o(dt, "yyyy"); // The year as a four-digit number.
    o(dt, "yyyyy"); // The year as a five-digit number.
    o(dt, "z"); // Hours offset from UTC, with no leading zeros.
    o(dt, "zz"); // Hours offset from UTC, with a leading zero for a single-digit value.
    o(dt, "zzz"); // Hours and minutes offset from UTC.
    o(dt, ":"); // The time separator.
    o(dt, "/"); // The date separator.
    o(dt, "\"string\"");
    o(dt, "'string'"); // Literal string delimiter.
    o(dt, "%s"); // Defines the following character as a custom format specifier.
    o(dt, "\t"); // The escape character.
    o(dt, "123-"); // Any other character - The character is copied to the result string unchanged.

    std::cout << "----------------------" << std::endl << std::endl;
}

static void date_info_print(const omni::chrono::date_time& dt)
{
    std::cout << ".is_dst = " << (dt.is_dst() ? "yes" : "no") << std::endl
              << ".to_binary = " << dt.to_binary() << std::endl
              << ".hash_code = " << dt.hash_code() << std::endl
              << ".kind = " << dt.kind() << std::endl
              << ".year = " << dt.year() << std::endl
              << ".month = " << static_cast<uint32_t>(dt.month()) << std::endl
              << ".day = " << static_cast<uint32_t>(dt.day()) << std::endl
              << ".day_of_week = " << dt.day_of_week() << std::endl
              << ".day_of_year = " << dt.day_of_year() << std::endl
              << ".hour = " << static_cast<uint32_t>(dt.hour()) << std::endl
              << ".minute = " << static_cast<uint32_t>(dt.minute()) << std::endl
              << ".second = " << static_cast<uint32_t>(dt.second()) << std::endl
              << ".millisecond = " << dt.millisecond() << std::endl
              << ".ticks = " << dt.ticks() << std::endl
              << ".time_of_day = " << dt.time_of_day() << std::endl
              << ".to_oa_date = " << dt.to_oa_date() << std::endl
              << ".to_file_time = " << dt.to_file_time() << std::endl
              << ".to_file_time_utc = " << dt.to_file_time_utc() << std::endl
              << ".to_string = '" << dt.to_string() << "'" << std::endl;
    std::cout << std::endl;
}

int main(int argc, char* argv[])
{
    omni::chrono::date_time n = omni::chrono::date_time::now();
    // omni::chrono::date_time u = omni::chrono::date_time::utc_now();
    date_info_print(n);
    date_format(n);

    std::cout << "------ TRYING PARSING!!!! -----" << std::endl;

    if (omni::chrono::date_time::try_parse("10/31/2024 12:34 PM", n)) {
        std::cout << "PARSED IT!!!!" << std::endl;
        date_info_print(n);
    } else {
        std::cout << "It did NOT work :(" << std::endl;
    }

    //date_info_print(u);
    //date_format(u);
    return 0;
}