std::time_put (3) - Linux Manuals
std::time_put: std::time_put
Command to display std::time_put
manual in Linux: $ man 3 std::time_put
NAME
std::time_put - std::time_put
Synopsis
Defined in header <locale>
template<
class CharT,
class OutputIt = std::ostreambuf_iterator<CharT>
> class time_put;
Class template std::time_put encapsulates date and time formatting rules. The I/O manipulator std::put_time uses the std::time_put facet of the I/O stream's locale to generate text representation of an std::tm object.
std-time put-inheritance.svg
Inheritance diagram
Type requirements
-
OutputIt must meet the requirements of LegacyOutputIterator.
Specializations
Two standalone (locale-independent) full specializations and two partial specializations are provided by the standard library:
Defined in header <locale>
std::time_put<char> creates narrow string representations of date and time
std::time_put<wchar_t> creates wide string representations of date and time
std::time_put<char, OutputIt> creates narrow string representations of date and time using custom output iterator
std::time_put<wchar_t, OutputIt> creates wide string representations of date and time using custom output iterator
In addition, every locale object constructed in a C++ program implements its own (locale-specific) versions of these specializations.
Member types
Member type Definition
char_type CharT
iter_type OutputIt
Member functions
constructs a new time_put facet
constructor (public member function)
destructs a time_put facet
destructor (protected member function)
invokes do_put
put (public member function)
Member objects
id of the locale
static std::locale::id id (public member object)
Protected member functions
do_put formats date/time and writes to output stream
(virtual protected member function)
[virtual]
Example
// Run this code
#include <iostream>
#include <ctime>
#include <iomanip>
#include <codecvt>
int main()
{
std::time_t t = std::time(NULL);
std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv(std::cout.rdbuf());
std::wostream out(&conv);
out.imbue(std::locale("ja_JP.utf8"));
// this I/O manipulator std::put_time uses std::time_put<wchar_t>
out << std::put_time(std::localtime(&t), L"%A %c") << '\n';
}
Output:
水曜日 2011年11月09日 12時32分05秒
See also
represents the system-supplied std::time_put for the named locale
time_put_byname (class template)
parses time/date values from an input character sequence into struct std::tm
time_get (class template)
put_time formats and outputs a date/time value according to the specified format
(function template)
(C++11)
Pages related to std::time_put
- std::time_put<CharT,OutputIt>::put,std::time_put<CharT,OutputIt>::do_put (3) - std::time_put<CharT,OutputIt>::put,std::time_put<CharT,OutputIt>::do_put
- std::time_put<CharT,OutputIt>::time_put (3) - std::time_put<CharT,OutputIt>::time_put
- std::time_put<CharT,OutputIt>::~time_put (3) - std::time_put<CharT,OutputIt>::~time_put
- std::time_put_byname (3) - std::time_put_byname
- std::time_base (3) - std::time_base
- std::time_get (3) - std::time_get
- std::time_get<CharT,InputIt>::date_order,std::time_get<CharT,InputIt>::do_date_order (3) - std::time_get<CharT,InputIt>::date_order,std::time_get<CharT,InputIt>::do_date_order
- std::time_get<CharT,InputIt>::get,std::time_get<CharT,InputIt>::do_get (3) - std::time_get<CharT,InputIt>::get,std::time_get<CharT,InputIt>::do_get
- std::time_get<CharT,InputIt>::get_date,std::time_get<CharT,InputIt>::do_get_date (3) - std::time_get<CharT,InputIt>::get_date,std::time_get<CharT,InputIt>::do_get_date
- std::time_get<CharT,InputIt>::get_monthname, (3) - std::time_get<CharT,InputIt>::get_monthname,
- std::time_get<CharT,InputIt>::get_monthname,std::time_get<CharT,InputIt>::do_get_monthname (3) - std::time_get<CharT,InputIt>::get_monthname,std::time_get<CharT,InputIt>::do_get_monthname
- std::time_get<CharT,InputIt>::get_time,std::time_get<CharT,InputIt>::do_get_time (3) - std::time_get<CharT,InputIt>::get_time,std::time_get<CharT,InputIt>::do_get_time
- std::time_get<CharT,InputIt>::get_weekday,std::time_get<CharT,InputIt>::do_get_weekday (3) - std::time_get<CharT,InputIt>::get_weekday,std::time_get<CharT,InputIt>::do_get_weekday
- std::time_get<CharT,InputIt>::get_year,std::time_get<CharT,InputIt>::do_get_year (3) - std::time_get<CharT,InputIt>::get_year,std::time_get<CharT,InputIt>::do_get_year