A new function has been added to the Expression Builder which allows you to format a date and output it as a string with a specified format. The function can be used on Calendar, Time or Timestamp controls.
For example, the following formula using the DATEFORMAT function can be used to take the date captured in a Calendar control (called Date of Visit) and will return it as a string in the format dd/MM/YYYY.
=DATEFORMAT('Date of Visit',"dd/MM/yyyy")
Specifiers
Important
Formats are case-sensitive
|
Format specifier
|
Description
|
Output Example
|
|---|---|---|
|
"d"
|
The day of the month, from 1 through 31.
|
17
|
|
"dd"
|
The day of the month, from 01 through 31.
|
17
|
|
"ddd"
|
The abbreviated name of the day of the week.
|
Wed
|
|
dddd"
|
The full name of the day of the week.
|
Wednesday
|
|
"M"
|
The month, from 1 through 12.
|
7
|
|
"MM"
|
The month, from 01 through 12.
|
07
|
|
"MMM"
|
The abbreviated name of the month.
|
Jul
|
|
"MMMM"
|
The full name of the month.
|
July
|
|
"y"
|
The year, from 0 to 99.
|
22
|
|
"yy"
|
The year, from 00 to 99.
|
22
|
|
"yyy"
|
The year, with a minimum of three digits.
|
2022
|
|
"yyyy"
|
The year as a four-digit number.
|
2022
|
|
"h"
|
The hour, using a 12-hour clock from 1 to 12.
|
2
|
|
"hh"
|
The hour, using a 12-hour clock from 01 to 12.
|
02
|
|
"H"
|
The hour, using a 24-hour clock from 0 to 23.
|
14
|
|
"HH"
|
The hour, using a 24-hour clock from 00 to 23.
|
14
|
|
"m"
|
The minute, from 0 through 59.
|
35
|
|
"mm"
|
The minute, from 00 through 59.
|
35
|
|
"s"
|
The second, from 0 through 59.
|
8
|
|
"ss"
|
The second, from 00 through 59.
|
08
|
|
"t"
|
The first character of the AM/PM designator.
|
P
|
|
"tt"
|
The AM/PM designator.
|
PM
|
|
"K"
|
Time zone information.
|
-01:00
|
|
"z"
|
Hours offset from UTC, with no leading zeros.
|
-1
|
|
"zz"
|
Hours offset from UTC, with a leading zero for a single-digit value.
|
-01
|
|
"zzz"
|
Hours and minutes offset from UTC.
|
-01:00
|
Example Formats
|
Format
|
Output Example
|
|---|---|
|
"dd/MM/yyyy"
|
17/07/2022
|
|
"ddd-dd MMM yy"
|
Wed-17 Jul 22
|
|
"HH:mm"
|
14:35
|
|
"dd/MM/yyyy HH:mm"
|
17/07/2022 14:35
|
|
"dd/MM/yyyy hh:mm:ss"
|
17/07/2022 02:35:08
|
WorkMobile2.0
This formula is only usable with the WorkMobile2.0 mobile apps