Formatter for datetimes.
More...
Inherits BFormat.
|
| BDateTimeFormat (const BDateTimeFormat &other) |
| Copy Constructor.
|
|
| BDateTimeFormat (const BLanguage &language, const BFormattingConventions &conventions) |
| Language and formatting convention constructor.
|
|
| BDateTimeFormat (const BLocale *locale=NULL) |
| Locale constructor.
|
|
virtual | ~BDateTimeFormat () |
| Destructor.
|
|
status_t | Format (BString &buffer, const time_t time, BDateFormatStyle dateStyle, BTimeFormatStyle timeStyle, const BTimeZone *timeZone=NULL) const |
| Fills in string with a formatted datetime for the given time, timeStyle, and timeZone for the locale.
|
|
ssize_t | Format (char *target, const size_t maxSize, const time_t time, BDateFormatStyle dateStyle, BTimeFormatStyle timeStyle) const |
| Fills in string with a formatted datetime up to maxSize bytes for the given time and style for the locale.
|
|
Formatter for datetimes.
- Since
- Haiku R1
◆ BDateTimeFormat() [1/3]
BDateTimeFormat::BDateTimeFormat |
( |
const BLocale * |
locale = NULL | ) |
|
Locale constructor.
- Parameters
-
locale | The locale to use, can be NULL for the default locale. |
◆ BDateTimeFormat() [2/3]
BDateTimeFormat::BDateTimeFormat |
( |
const BLanguage & |
language, |
|
|
const BFormattingConventions & |
format |
|
) |
| |
Language and formatting convention constructor.
- Parameters
-
language | The language to use. |
format | The formatting convention to use. |
◆ BDateTimeFormat() [3/3]
Copy Constructor.
- Parameters
-
- Since
- Haiku R1
◆ ~BDateTimeFormat()
BDateTimeFormat::~BDateTimeFormat |
( |
| ) |
|
|
virtual |
Destructor.
- Since
- Haiku R1
◆ Format() [1/2]
status_t BDateTimeFormat::Format |
( |
BString & |
buffer, |
|
|
const time_t |
time, |
|
|
BDateFormatStyle |
dateStyle, |
|
|
BTimeFormatStyle |
timeStyle, |
|
|
const BTimeZone * |
timeZone = NULL |
|
) |
| const |
Fills in string with a formatted datetime for the given time, timeStyle, and timeZone for the locale.
- Parameters
-
buffer | The string buffer to fill with the formatted date. |
time | The time (in seconds since epoch) to format |
dateStyle | Specifies the long format or the short format of the date. |
timeStyle | Specifies the long format or the short format of the time. |
timeZone | Specifies the time zone to use, if NULL , use the system default time zone (usually UTC). |
- Returns
- A status code.
- Return values
-
B_OK | Everything went fine. |
B_ERROR | Unable to lock the BLocale. |
B_NO_MEMORY | Ran out of memory while creating the object. |
- Since
- Haiku R1
◆ Format() [2/2]
ssize_t BDateTimeFormat::Format |
( |
char * |
target, |
|
|
const size_t |
maxSize, |
|
|
const time_t |
time, |
|
|
BDateFormatStyle |
dateStyle, |
|
|
BTimeFormatStyle |
timeStyle |
|
) |
| const |
Fills in string with a formatted datetime up to maxSize bytes for the given time and style for the locale.
- Parameters
-
target | The string buffer to fill with the formatted datetime. |
maxSize | The size of the buffer. |
time | The time (in seconds since epoch) to format |
dateStyle | Specify the long format or the short format of the date. |
timeStyle | Specify the long format or the short format of the time. |
- Returns
- The number of bytes written during the datetime formatting.
- Return values
-
B_ERROR | Unable to lock the BLocale. |
B_NO_MEMORY | Ran out of memory while creating the object. |
B_BAD_VALUE | There was not enough space to store the result. |
- Since
- Haiku R1