aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/qmldate.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/declarative/qmldate.qdoc')
-rw-r--r--doc/src/declarative/qmldate.qdoc51
1 files changed, 46 insertions, 5 deletions
diff --git a/doc/src/declarative/qmldate.qdoc b/doc/src/declarative/qmldate.qdoc
index 74b3a7a3c7..93cb8dd916 100644
--- a/doc/src/declarative/qmldate.qdoc
+++ b/doc/src/declarative/qmldate.qdoc
@@ -2,7 +2,7 @@
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -36,16 +36,16 @@
Functions that accept a locale format may be either an enumeration
value:
\table
- \row \i Locale.LongFormat \i The long version of day and month names; for example, returning "January" as a month name.
- \row \i Locale.ShortFormat \i The short version of day and month names; for example, returning "Jan" as a month name.
- \row \i Locale.NarrowFormat \i A special version of day and month names for use when space is limited;
+ \row \i Locale.LongFormat \i The long version of the string; for example, returning "January" as a month name.
+ \row \i Locale.ShortFormat \i The short version of the string; for example, returning "Jan" as a month name.
+ \row \i Locale.NarrowFormat \i A special version for use when space is limited;
for example, returning "J" as a month name. Note that the narrow format might contain
the same text for different months and days or it can even be an empty string if the
locale doesn't support narrow names, so you should avoid using it for date formatting.
Also, for the system locale this format is the same as ShortFormat.
\endtable
- or a string specifying the format:
+ or a string specifying the format These expressions may be used for format dates:
\table
\header \i Expression \i Output
\row \i d \i the day as number without a leading zero (1 to 31)
@@ -80,6 +80,47 @@
\row \o 'The day is' dddd \o The day is Sunday
\endtable
+ These expressions may be used for formatting time:
+
+ \table
+ \header \i Expression \i Output
+ \row \i h
+ \i the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
+ \row \i hh
+ \i the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
+ \row \i H
+ \i the hour without a leading zero (0 to 23, even with AM/PM display)
+ \row \i HH
+ \i the hour with a leading zero (00 to 23, even with AM/PM display)
+ \row \i m \i the minute without a leading zero (0 to 59)
+ \row \i mm \i the minute with a leading zero (00 to 59)
+ \row \i s \i the second without a leading zero (0 to 59)
+ \row \i ss \i the second with a leading zero (00 to 59)
+ \row \i z \i the milliseconds without leading zeroes (0 to 999)
+ \row \i zzz \i the milliseconds with leading zeroes (000 to 999)
+ \row \i AP or A
+ \i use AM/PM display. \e AP will be replaced by either "AM" or "PM".
+ \row \i ap or a
+ \i use am/pm display. \e ap will be replaced by either "am" or "pm".
+ \row \i t \i the timezone (for example "CEST")
+ \endtable
+
+ All other input characters will be ignored. Any sequence of characters that
+ are enclosed in singlequotes will be treated as text and not be used as an
+ expression. Two consecutive singlequotes ("''") are replaced by a singlequote
+ in the output.
+
+ Example format strings (assuming that the QTime is 14:13:09.042)
+
+ \table
+ \header \i Format \i Result
+ \row \i hh:mm:ss.zzz \i 14:13:09.042
+ \row \i h:m:s ap \i 2:13:9 pm
+ \row \i H:m:s a \i 14:13:9 pm
+ \endtable
+
+ If the date is invalid, an empty string will be returned.
+
\sa {QtQuick2::Locale}{Locale}
*/