The C++20 standard has enriched the std::chrono namespace with calendar features. They include all the typical features you would expect, plus a more idiomatic and intuitive way of playing with it. This recipe will teach you about some of the most important features and how simple it is to interact with the calendar section of the std::chrono namespace.
Using the C++20 calendar and time zone
How to do it...
Let's look at some code:
- Create a new file, ensuring that you include <chrono> and <iostream>. We have a date and we want to know what day of the week bday will fall on:
#include <chrono> #include <iostream>
using namespace std;
using namespace std::chrono;
int main ()
{
auto...