|
| DateTimeFormat (String format="%t %T", String dateFormat="%t", String timeFormat="%T") |
| Construct a new DateTimeFormat. More...
|
|
| ~DateTimeFormat () |
| Destructor. More...
|
|
void | setFormat (const String &format) |
| Set the format for dates with times. More...
|
|
void | setDateFormat (const String &dateFormat) |
| Set the format for dates. More...
|
|
void | setTimeFormat (const String &timeFormat) |
| Set the format for times. More...
|
|
String | format (const Date &value) const |
| Format a Date. More...
|
|
size_t | format (const Date &value, char *buf, size_t bufsz) const |
| Format a DateTime. More...
|
|
String | format (const Time &value) const |
| Format a Time. More...
|
|
size_t | format (const Time &value, char *buf, size_t bufsz) const |
| Format a DateTime. More...
|
|
String | format (const DateTime &value) const |
| Format a DateTime. More...
|
|
size_t | format (const DateTime &value, char *buf, size_t bufsz) const |
| Format a DateTime. More...
|
|
void | parse (Date &value, const String &text) const |
| Parse a Date from a string. More...
|
|
void | parse (Time &value, const String &text) const |
| Parse a Time from a string. More...
|
|
void | parse (DateTime &value, const String &text) const |
| Parse a DateTime from a string. More...
|
|
A formatter for dates and times.
Available format directives are enumerated below. Unrecognized directives are ignored, and all other text is treated literally.
Directive | Meaning | Range |
%H | Hour of 24-hour clock | 0 - 23 |
%%0H | Hour of 24-hour clock (padded with leading zeroes) | 00 - 23 |
%_H | Hour of 24-hour clock (padded with leading spaces) | 0 - 23 |
%h | Hour of 12-hour clock | 1 - 12 |
%%0h | Hour of 12-hour clock (padded with leading zeroes) | 01 - 12 |
%_h | Hour of 12-hour clock (padded with leading spaces) | 1 - 12 |
%M | Minutes (unpadded) | 0 - 59 |
%%0M | Minutes (padded with leading zeroes) | 00 - 59 |
%_M | Minutes (padded with leading spaces) | 0 - 59 |
%S | Seconds (unpadded) | 0 - 60 |
%%0S | Seconds (padded with leading zeroes) | 00 - 60 |
%_S | Seconds (padded with leading spaces) | 0 - 60 |
%s | Milliseconds (unpadded) | 0 - 999 |
%%0s | Milliseconds (padded with leading zeroes) | 000 - 999 |
%_s | Milliseconds (padded with leading spaces) | 0 - 999
|
%d | Day of month | 1 - 31 |
%%0d | Day of month (padded with leading zeroes) | 01 - 31 |
%_d | Day of month (padded with leading spaces) | 1 - 31
|
%D | Day of year | 1 - 366 |
%%0D | Day of year (padded with leading zeroes) | 001 - 366 |
%_D | Day of year (padded with leading spaces) | 1 - 366
|
%m | Month number (1 = January) | 1 - 12 |
%%0m | Month number (1 = January) (padded with leading zeroes) | 01 - 12 |
%_m | Month number (1 = January) (padded with leading spaces) | 1 - 12 |
$m | Abbreviated month name |
%$$m | Full month name |
%w | Weekday number (0 = Sunday) | 0 - 6 |
$w | Abbreviated weekday name |
%$$w | Full weekday name
|
%W | Week number (ISO standard) | 0 - 52 |
%%0W | Week number (ISO standard) (padded with leading zeroes) | 00 - 52 |
%_w | Week number (ISO standard) (padded with leading spaces) | 0 - 52
|
%y | 2-digit year | 0 - 99 |
%%0y | 2-digit year (padded with leading zeroes) | 00 - 99 |
%_y | 2-digit year (padded with leading spaces) | 0 - 99 |
%Y | 4-digit year | 0 - 9999 |
%%0Y | 4-digit year (padded with leading zeroes) | 0000 - 9999 |
%_Y | 4-digit year (padded with leading spaces) | 0 - 9999
|
%P | Meridiem (uppercase) (local form of "AM" or "PM") |
%p | Meridiem (lowercase) (local form of "am" or "pm") |
%t | Date |
%T | Time |
%Z | Time zone name |
%% | Percent sign |
- Author
- Mark Lindner