<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Class Poco::DateTimeFormatter</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="language" content="en"/> <meta name="date" content="2009-11-24"/> <meta name="generator" content="PocoDoc"/> <link rel="stylesheet" href="css/styles.css" type="text/css"/> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0"> <div class="header"> <h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1> <h1 class="symbol">class DateTimeFormatter</h1> </div> <div class="body"> <p> <b>Library:</b> Foundation<br /> <b>Package:</b> DateTime<br /> <b>Header:</b> Poco/DateTimeFormatter.h</p> <h2>Description</h2> <div class="description"> <p>This class converts dates and times into strings, supporting a variety of standard and custom formats. </p> <p>There are two kind of static member functions: </p> <ul> <li>format* functions return a std::string containing the formatted value. </li> <li>append* functions append the formatted value to an existing string. </li> </ul> </div> <h2>Member Summary</h2> <p><b>Member Functions: </b><a href="Poco.DateTimeFormatter.html#4514" title="Poco::DateTimeFormatter::append()">append</a>, <a href="Poco.DateTimeFormatter.html#4500" title="Poco::DateTimeFormatter::format()">format</a>, <a href="Poco.DateTimeFormatter.html#4532" title="Poco::DateTimeFormatter::tzdISO()">tzdISO</a>, <a href="Poco.DateTimeFormatter.html#4534" title="Poco::DateTimeFormatter::tzdRFC()">tzdRFC</a></p> <h2>Enumerations</h2> <h3><i>Anonymous</i></h3> <div class="description"> <p></p> </div> <p class="decl"><a name="4499">UTC</a> = 0xFFFF</p> <div class="description"> <p>Special value for timeZoneDifferential denoting <a href="Poco.DateTimeFormatter.html#4499" title="Poco::DateTimeFormatter::UTC">UTC</a>. </p> </div> <h2>Member Functions</h2> <h3><a name="4514">append</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void append(<br /> std::string & str,<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & timestamp,<br /> const std::string & fmt,<br /> int timeZoneDifferential = UTC<br />);</p> <div class="description"> <p>Formats the given timestamp according to the given format and appends it to str. </p> <p>See <a href="Poco.DateTimeFormatter.html#4500" title="Poco::DateTimeFormatter::format()">format</a>() for documentation of the formatting string. </p> </div> <h3><a name="4519">append</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void append(<br /> std::string & str,<br /> const <a href="Poco.DateTime.html" title="class Poco::DateTime">DateTime</a> & dateTime,<br /> const std::string & fmt,<br /> int timeZoneDifferential = UTC<br />);</p> <div class="description"> <p>Formats the given date and time according to the given format and appends it to str. </p> <p>See <a href="Poco.DateTimeFormatter.html#4500" title="Poco::DateTimeFormatter::format()">format</a>() for documentation of the formatting string. </p> </div> <h3><a name="4524">append</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void append(<br /> std::string & str,<br /> const <a href="Poco.LocalDateTime.html" title="class Poco::LocalDateTime">LocalDateTime</a> & dateTime,<br /> const std::string & fmt<br />);</p> <div class="description"> <p>Formats the given local date and time according to the given format and appends it to str. </p> <p>See <a href="Poco.DateTimeFormatter.html#4500" title="Poco::DateTimeFormatter::format()">format</a>() for documentation of the formatting string. </p> </div> <h3><a name="4528">append</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void append(<br /> std::string & str,<br /> const <a href="Poco.Timespan.html" title="class Poco::Timespan">Timespan</a> & timespan,<br /> const std::string & fmt = "%dd %H:%M:%S.%i"<br />);</p> <div class="description"> <p>Formats the given timespan according to the given format and appends it to str. </p> <p>See <a href="Poco.DateTimeFormatter.html#4500" title="Poco::DateTimeFormatter::format()">format</a>() for documentation of the formatting string. </p> </div> <h3><a name="4500">format</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static std::string format(<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & timestamp,<br /> const std::string & fmt,<br /> int timeZoneDifferential = UTC<br />);</p> <div class="description"> <p>Formats the given timestamp according to the given format. The format string is used as a template to format the date and is copied character by character except for the following special characters, which are replaced by the corresponding value. </p> <p></p> <ul> <li>%w - abbreviated weekday (Mon, Tue, ...) </li> <li>%W - full weekday (Monday, Tuesday, ...) </li> <li>%b - abbreviated month (Jan, Feb, ...) </li> <li>%B - full month (January, February, ...) </li> <li>%d - zero-padded day of month (01 .. 31) </li> <li>%e - day of month (1 .. 31) </li> <li>%f - space-padded day of month ( 1 .. 31) </li> <li>%m - zero-padded month (01 .. 12) </li> <li>%n - month (1 .. 12) </li> <li>%o - space-padded month ( 1 .. 12) </li> <li>%y - year without century (70) </li> <li>%Y - year with century (1970) </li> <li>%H - hour (00 .. 23) </li> <li>%h - hour (00 .. 12) </li> <li>%a - am/pm </li> <li>%A - AM/PM </li> <li>%M - minute (00 .. 59) </li> <li>%S - second (00 .. 59) </li> <li>%i - millisecond (000 .. 999) </li> <li>%c - centisecond (0 .. 9) </li> <li>%F - fractional seconds/microseconds (000000 - 999999) </li> <li>%z - time zone differential in ISO 8601 format (Z or +NN.NN). </li> <li>%Z - time zone differential in RFC format (GMT or +NNNN) </li> <li>%% - percent sign </li> </ul> <p>Class <a href="Poco.DateTimeFormat.html" title="class Poco::DateTimeFormat">DateTimeFormat</a> defines format strings for various standard date/time formats. </p> </div> <h3><a name="4504">format</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static std::string format(<br /> const <a href="Poco.DateTime.html" title="class Poco::DateTime">DateTime</a> & dateTime,<br /> const std::string & fmt,<br /> int timeZoneDifferential = UTC<br />);</p> <div class="description"> <p>Formats the given date and time according to the given format. See <a href="Poco.DateTimeFormatter.html#4500" title="Poco::DateTimeFormatter::format()">format</a>(const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>&, const std::string&, int) for more information. </p> </div> <h3><a name="4508">format</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static std::string format(<br /> const <a href="Poco.LocalDateTime.html" title="class Poco::LocalDateTime">LocalDateTime</a> & dateTime,<br /> const std::string & fmt<br />);</p> <div class="description"> <p>Formats the given local date and time according to the given format. See <a href="Poco.DateTimeFormatter.html#4500" title="Poco::DateTimeFormatter::format()">format</a>(const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>&, const std::string&, int) for more information. </p> </div> <h3><a name="4511">format</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static std::string format(<br /> const <a href="Poco.Timespan.html" title="class Poco::Timespan">Timespan</a> & timespan,<br /> const std::string & fmt = "%dd %H:%M:%S.%i"<br />);</p> <div class="description"> <p>Formats the given timespan according to the given format. The format string is used as a template to format the date and is copied character by character except for the following special characters, which are replaced by the corresponding value. </p> <p></p> <ul> <li>%d - days </li> <li>%H - hours (00 .. 23) </li> <li>%h - total hours (0 .. n) </li> <li>%M - minutes (00 .. 59) </li> <li>%m - total minutes (0 .. n) </li> <li>%S - seconds (00 .. 59) </li> <li>%s - total seconds (0 .. n) </li> <li>%i - milliseconds (000 .. 999) </li> <li>%c - centisecond (0 .. 9) </li> <li>%F - fractional seconds/microseconds (000000 - 999999) </li> <li>%% - percent sign </li> </ul> </div> <h3><a name="4532">tzdISO</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static std::string tzdISO(<br /> int timeZoneDifferential<br />);</p> <div class="description"> <p>Formats the given timezone differential in ISO format. If timeZoneDifferential is <a href="Poco.DateTimeFormatter.html#4499" title="Poco::DateTimeFormatter::UTC">UTC</a>, "Z" is returned, otherwise, +HH.MM (or -HH.MM) is returned. </p> </div> <h3><a name="4536">tzdISO</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void tzdISO(<br /> std::string & str,<br /> int timeZoneDifferential<br />);</p> <div class="description"> <p>Formats the given timezone differential in ISO format and appends it to the given string. If timeZoneDifferential is <a href="Poco.DateTimeFormatter.html#4499" title="Poco::DateTimeFormatter::UTC">UTC</a>, "Z" is returned, otherwise, +HH.MM (or -HH.MM) is returned. </p> </div> <h3><a name="4534">tzdRFC</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static std::string tzdRFC(<br /> int timeZoneDifferential<br />);</p> <div class="description"> <p>Formats the given timezone differential in RFC format. If timeZoneDifferential is <a href="Poco.DateTimeFormatter.html#4499" title="Poco::DateTimeFormatter::UTC">UTC</a>, "GMT" is returned, otherwise ++HHMM (or -HHMM) is returned. </p> </div> <h3><a name="4539">tzdRFC</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void tzdRFC(<br /> std::string & str,<br /> int timeZoneDifferential<br />);</p> <div class="description"> <p>Formats the given timezone differential in RFC format and appends it to the given string. If timeZoneDifferential is <a href="Poco.DateTimeFormatter.html#4499" title="Poco::DateTimeFormatter::UTC">UTC</a>, "GMT" is returned, otherwise ++HHMM (or -HHMM) is returned. </p> </div> <p class="footer">POCO C++ Libraries 1.3.6-all<br /> Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p> </div> </body> </html>