//******************************************************** // The following code example is taken from the book // C++20 - The Complete Guide // by Nicolai M. Josuttis (www.josuttis.com) // http://www.cppstd20.com // // The code is licensed under a // Creative Commons Attribution 4.0 International License // http://creativecommons.org/licenses/by/4.0/ //******************************************************** #include #include int main() { namespace chr = std::chrono; // shortcut for std::chrono using namespace std::literals; // for h, min, y suffixes // for each last of all months of 2021: auto first = 2021y / 1 / chr::last; for (auto d = first; d.year() == first.year(); d += chr::months{1}) { // print out the date: std::cout << d << ":\n"; // init and print 18:30 UTC of those days: auto tp{chr::sys_days{d} + 18h + 30min}; std::cout << std::format(" We meet on {:%A %D at %R}\n", tp); } }