Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut authored Dec 26, 2023
1 parent 4cbf618 commit 3a25a58
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <fmt/chrono.h>

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))

Expand Down

0 comments on commit 3a25a58

Please sign in to comment.