CustomDateFormatter

Since: BlackBerry 10.0.0

#include <bb/utility/i18n/CustomDateFormatter>

To link against this class, add the following line to your .pro file: LIBS += -lbbutilityi18n

Formats QDateTime objects using skeleton patterns.

A date/time format skeleton is a QString containing any arrangement of icu::SimpleDateFormat pattern characters specified by the Internationalization Components for Unicode (ICU). See Supported ICU date characters for more information. The QString that is passed in to setSkeleton() should contain only character sequences from the ICU column of the table.

Do not include any whitespace or punctuation. The formatter will automatically format using the most appropriate date-time pattern for the current system settings.

See Sample skeleton patterns for examples of date formatting using these patterns.


Overview

Properties Index

Public Functions Index

CustomDateFormatter (const QString &skeleton=QString(), QObject *parent=0)
virtual ~CustomDateFormatter ()
Q_INVOKABLE QStringformat (const QDateTime &dateTime) const
Q_INVOKABLE boolisValid () const
Q_SLOT voidsetSkeleton (const QString &skeleton)
QStringskeleton () const

Properties

QString skeleton

A collection of letter sequences used for parsing and formatting dates.

Since:

BlackBerry 10.0.0

Public Functions

CustomDateFormatter (

Creates a date/time formatter of the supplied skeleton type.

Parameters
skeleton

The skeleton this object should format with.

parent

If not 0, the supplied parent will be responsible for deleting this instance.

Since:

BlackBerry 10.0.0

virtual~CustomDateFormatter ()

Destructor.

Since:

BlackBerry 10.0.0

Q_INVOKABLE QString format (

Prints out date and time components formatted and localized according to the system settings.

Parameters
dateTime

A QDateTime object that should be printed using this format.

Return:

A QString with a localized and formatted date and time.

Since:

BlackBerry 10.0.0

Q_INVOKABLE bool isValid ()

Verifies if this formatter was created successfully.

Return:

true if this DateFormatter is ready to use, false otherwise.

Since:

BlackBerry 10.0.0

Q_SLOT void setSkeleton (

Changes the skeleton used for parsing and formatting dates.

Parameters
skeleton

A QString to use as the new skeleton.

Since:

BlackBerry 10.0.0

QString skeleton ()

Returns the skeleton used for parsing and formatting dates/time.

Return:

The skeleton used for parsing and formatting dates/time.

Since:

BlackBerry 10.0.0

Last modified: 2015-04-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus