Skip to content

Commit

Permalink
Update date formatting example to use threadsafe localtime
Browse files Browse the repository at this point in the history
  • Loading branch information
lsr0 authored and vitaut committed May 2, 2020
1 parent d6abb2f commit d59751f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ formatting::

std::time_t t = std::time(nullptr);
// 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
`strftime <http://en.cppreference.com/w/cpp/chrono/c/strftime>`_.
Expand Down

0 comments on commit d59751f

Please sign in to comment.