From 3a25a5848258aa2527d45f404257da1c488694fd Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 26 Dec 2023 11:12:02 -0800 Subject: [PATCH] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 697a6efa..dcfb16ec 100644 --- a/README.md +++ b/README.md @@ -96,22 +96,22 @@ std::string s = fmt::format("I'd rather be {1} than {0}.", "right", "happy"); // s == "I'd rather be happy than right." ``` -**Print chrono durations** ([run](https://godbolt.org/z/K8s4Mc)) +**Print dates and times** ([run](https://godbolt.org/z/c31ExdY3W)) ``` c++ #include int main() { - using namespace std::literals::chrono_literals; - fmt::print("Default format: {} {}\n", 42s, 100ms); - fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s); + auto now = std::chrono::system_clock::now(); + fmt::print("Date and time: {}\n", now); + fmt::print("Time: {:%H:%M}\n", now); } ``` Output: - Default format: 42s 100ms - strftime-like format: 03:15:30 + Date and time: 2023-12-26 19:10:31.557195597 + Time: 19:10 **Print a container** ([run](https://godbolt.org/z/MxM1YqjE7))