Library: Foundation
Package: DateTime
Header: Poco/DateTimeFormatter.h
This class converts dates and times into strings, supporting a variety of standard and custom formats.
Member Functions: format, tzdISO, tzdRFC
UTC = 0xFFFF
Special value for timeZoneDifferential denoting UTC.
static std::string format(
const Timestamp & timestamp,
const std::string & fmt,
int timeZoneDifferential = UTC
);
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.
Class DateTimeFormat defines format strings for various standard date/time formats.
static std::string format(
const DateTime & dateTime,
const std::string & fmt,
int timeZoneDifferential = UTC
);
Formats the given date and time according to the given format. See format(const Timestamp&, const std::string&, int) for more information.
static std::string format(
const LocalDateTime & dateTime,
const std::string & fmt
);
Formats the given local date and time according to the given format. See format(const Timestamp&, const std::string&, int) for more information.
static std::string format(
const Timespan & timespan,
const std::string & fmt = "%dd %H:%M:%S.%i"
);
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.
static std::string tzdISO(
int timeZoneDifferential
);
Formats the given timezone differential in ISO format. If timeZoneDifferential is UTC, "Z" is returned, otherwise, +HH.MM (or -HH.MM) is returned.
static std::string tzdRFC(
int timeZoneDifferential
);
Formats the given timezone differential in RFC format. If timeZoneDifferential is UTC, "GMT" is returned, otherwise ++HHMM (or -HHMM) is returned.