This component is used to display date/time text in a specified format. The format characters specified by format are displayed in the default language of the mobile phone. You can set common attributes and the transparency, scaling, and rotation animations for date/time text.
Parameter | Type | Mandatory | Description |
|---|---|---|---|
name | String | No | Date/Time variable name. If this parameter is set, the @name.date variable is generated, which stores the formatted date/time text. |
format | String | Yes | Date/Time format. The following tables describe format characters in this string. (During actual application, if any format characters listed in the following tables are contained in format, they are replaced with the actual values. Other characters remain unchanged.) If format is not set, information such as the year, month, date, and day of the week is displayed based on the region and language settings. |
color | String | No | Date/Time text color. The value can be a 6- or 8-digit hexadecimal color code, for example, #ffffff. |
size | Number | Yes | Date/Time text size. Expressions are supported. The default value is 0. |
The following tables describe time format characters.
Common format characters:
Letter | Description | Type | Example |
|---|---|---|---|
y | Year. | Year | y, yyy, or yyyy: 2019 (four digits) yy: 19 (two digits) |
M | Month of the year. | Month | M: 7 MM: 07 MMM: Jul MMMM: July MMMMM: J, 7 |
d | Day of the month. | Number | d: 5 dd: 05 |
E | Day of the week. | Text | E, EE, or EEE: Fri EEEE: Friday EEEEE: F |
a | AM/PM. | Text | AM or PM |
H | Hour of the day. The value ranges from 0 to 23. Whether to use the 12- or 24-hour clock to display the time depends on the system setting of the mobile phone. | Number | 0 |
k | Hour of the day. The value ranges from 1 to 24. Whether to use the 12- or 24-hour clock to display the time depends on the system setting of the mobile phone. | Number | 24 |
K | Morning or afternoon hour. The value ranges from 0 to 11. Whether to use the 12- or 24-hour clock to display the time depends on the system setting of the mobile phone. | Number | 0 |
h | Morning or afternoon hour. The value ranges from 1 to 12. Whether to use the 12- or 24-hour clock to display the time depends on the system setting of the mobile phone. | Number | 12 |
m | Minute in an hour. | Number | m: 7 mm: 07 mmm: 007 mmmm: 0007 |
s | Second in a minute. | Number | s: 7 ss: 07 sss: 007 ssss: 0007 |
z | Time zone. | Text | zzzz: China Standard Time ZZZZZ: +08:00 ZZZZ: GMT+08:00 z, Z, ZZ, or ZZZ: +0800 |
Display a time with the transparent animation effect. In detail, configure time images to transit from transparent to opaque within 1000 milliseconds to make the time blink.
<!--Date with the animation effect.-->
<DateTime x="20" y="450" color="#000000" size="40" format="yyyy.M.d. E" >
<AlphaAnimation>
<Alpha a="0" time="0"/>
<Alpha a="255" time="1000"/>
</AlphaAnimation>
</DateTime>