From Time Point to Calendar Time
This lesson gives a brief introduction to calendar time and its usage in C++ with the help of interactive examples.
We'll cover the following
Thanks to std::chrono::system_clock::to_time_t
, you can convert a time point that internally uses std::chrono::system_clock
to an object of type std::time_t
. Further conversion of the std::time_t
object with the function std::gmtime
gives you the calendar time, expressed in Coordinated Universal Time (UTC). In the end, this calendar time can be used as the input for the function std::asctime
to get a textual representation of the calendar time.
Get hands-on with 1400+ tech skills courses.