The following code example is taken from the book
C++20 - The Complete Guide
by Nicolai M. Josuttis,
Leanpub, 2021
The code is licensed under a
Creative Commons Attribution 4.0 International License.
// raw code
#include "chronoparse.hpp"
#include <iostream>
int main()
{
auto tp1 = parseDateTime("2021-1-1");
std::cout << std::format("{:%F %T %Z}\n", tp1);
auto tp2 = parseDateTime<std::chrono::local_t>("2021-1-1");
std::cout << std::format("{:%F %T}\n", tp2);
auto tp3 = parseDateTime<std::chrono::utc_clock>("2015-6-30 23:59:60");
std::cout << std::format("{:%F %T %Z}\n", tp3);
auto tp4 = parseDateTime<std::chrono::gps_clock>("2021-1-1 18:30");
std::cout << std::format("{:%F %T %Z}\n", tp4);
}