mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 02:29:08 +00:00
Update date formatting example to use threadsafe localtime
This commit is contained in:
parent
d6abb2fa03
commit
d59751f0f0
@ -408,7 +408,7 @@ formatting::
|
|||||||
|
|
||||||
std::time_t t = std::time(nullptr);
|
std::time_t t = std::time(nullptr);
|
||||||
// Prints "The date is 2016-04-29." (with the current date)
|
// Prints "The date is 2016-04-29." (with the current date)
|
||||||
fmt::print("The date is {:%Y-%m-%d}.", *std::localtime(&t));
|
fmt::print("The date is {:%Y-%m-%d}.", fmt::localtime(t));
|
||||||
|
|
||||||
The format string syntax is described in the documentation of
|
The format string syntax is described in the documentation of
|
||||||
`strftime <http://en.cppreference.com/w/cpp/chrono/c/strftime>`_.
|
`strftime <http://en.cppreference.com/w/cpp/chrono/c/strftime>`_.
|
||||||
|
Loading…
Reference in New Issue
Block a user