Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/chrono/zoned time/formatter"

From cppreference.com
< cpp‎ | chrono‎ | zoned time
(+)
 
m (langlinks)
Line 36: Line 36:
 
{{dsc inc | cpp/utility/format/dsc format}}
 
{{dsc inc | cpp/utility/format/dsc format}}
 
{{dsc end}}
 
{{dsc end}}
 +
 +
{{langlinks|ja|zh}}

Revision as of 04:51, 20 November 2019

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
 
Defined in header <chrono>
template<class Duration, class TimeZonePtr, class CharT>

struct formatter<std::chrono::zoned_time<Duration, TimeZonePtr>, CharT>

    : std::formatter<std::chrono::/*local-time-format-t*/<Duration>, CharT>

Specialization of std::formatter that defines formatting rules for a std::chrono::zoned_time.

This formatter uses std::chrono::local_time_format for formatting.

The parse member is inherited from the base class.

Let tp be the formatting argument, ctx be the formatting context. The behavior of the format member is equivalent to

auto info = tp.get_info();
return std::formatter<std::chrono::/*local-time-format-t*/>::format(
    std::local_time_format(tp.get_local_time(), &info.abbrev, &info.offset), ctx);

The std::formatter specialization is usually not directly accessed, but is used through formatting functions.

Format specification

Template:cpp/chrono/to stream format

Example

See also

(C++20)
stores formatted representation of the arguments in a new string
(function template) [edit]