Horizon Posted November 28, 2024 Share Posted November 28, 2024 In this blog post, we will explore handling dates using std::chrono, including time zones. We’ll utilize the latest features of the library to retrieve the current time across various time zones, taking into account daylight saving time changes as well. Additionally, we will incorporate new capabilities introduced in C++23, such as enhanced printing functions and more. What is the Current Time Around the World? Utilizing std::chrono with Time Zones in C++23 by Bartlomiej Filipek From the article: Let’s start with the following code that prints the current date and time: #include <chrono> #include <print> int main() { auto now = std::chrono::system_clock::now(); std::print("now is {}", now); } You can run it through Compiler Explorer In my session, I’m getting the following results: Now is 2024-11-01 11:44:06.374573703 View the full article Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.