Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

time_put

Library:  Localization


time_put locale::facet

Local Index

Members

Summary

A time formatting facet for output

Synopsis

#include <locale>

namespace std {
  template <class charT, class OutputIterator = 
              ostreambuf_iterator<charT> >
  class time_put;
}

Specializations

Description

The time_put facet includes facilities for formatted output of date/time values. The put() member functions format a struct tm that represents a date/time into a character string representation.

Interface

Member Types

char_type
iter_type

Constructor

explicit time_put(size_t refs = 0); 

Destructor

virtual ~time_put(); 

Facet ID

static locale::id id;

Public Member Functions

iter_type 
put(iter_type s, ios_base& f, 
    char_type fill, const tm* tmb,
    const char_type* pattern, const char_type* pat_end) const; 
iter_type 
put(iter_type s, ios_base& f, char_type fill,
    const tm* tmb, char format, char modifier = 0) const;

Protected Member Functions

iter_type 
do_put(iter_type s, ios_base& f, char_type fill,
    const tm* tmb, char format, char modifier = 0) const; 

In the C locale, the 'E' and 'O' modifiers are ignored.

The behavior of the functions is undefined if the modifier is other than '\0', 'E' and 'O', or if the format character is other than those specified in Table 36 above.

For example, if the set of a locale's alternative numeric symbols consists of { "", "1st", "2nd", "3rd", ... , "31st"} then the date Wednesday, February 29, 1984 will be formatted using "%Od" as "29th".

Example

Program Output:

With the TZ environment variable defined to a value equivalent to PST8PDT, the output of the program will be as follows:

See Also

locale, Facets, time_get

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 25.2.5.3

ISO/IEC 9899:1999 -- Programming Language C, Section 7.23.3.5, paragraph 3

IEEE Std 1003.1-2001 -- The Open Group Base Specifications Issue 6, strftime

ISO 8601:2000 -- Data elements and interchange formats -- Information interchange -- Representation of dates and times

IEEE Std 1003.1-2001 -- The Open Group Base Specifications Issue 6, Character Set



Previous fileTop of DocumentContentsIndex pageNext file