mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-27 21:31:20 +00:00
Update README.md
This commit is contained in:
parent
4cbf6182ea
commit
3a25a58482
12
README.md
12
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."
|
// 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++
|
``` c++
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace std::literals::chrono_literals;
|
auto now = std::chrono::system_clock::now();
|
||||||
fmt::print("Default format: {} {}\n", 42s, 100ms);
|
fmt::print("Date and time: {}\n", now);
|
||||||
fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s);
|
fmt::print("Time: {:%H:%M}\n", now);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
Default format: 42s 100ms
|
Date and time: 2023-12-26 19:10:31.557195597
|
||||||
strftime-like format: 03:15:30
|
Time: 19:10
|
||||||
|
|
||||||
**Print a container** ([run](https://godbolt.org/z/MxM1YqjE7))
|
**Print a container** ([run](https://godbolt.org/z/MxM1YqjE7))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user