FormatDateTime
Date/time modifier formats take the date/time values and convert them to text in several different ways. After applying a date/time format, the result is considered text.
Syntax
FormatDateTime(inputDateTime, formatSpecifier, customFormat, timeZone)
Enabled For
For a description of the business object categories, see Notes on "Enabled For".
Business Object Category | Yes/No |
---|---|
Business Rules: Before-Save Rules | Yes |
Business Rules: Calculation Rules (After Save, with or without Also Recalculate on Load) | Yes1 |
Business Rules: Calculation Rules (Before Save or Always, without Also Recalculate On Load) | Yes |
Business Rules: Calculation Rules (Before Save or Always, with Recalculate On Load) | Yes1 |
Business Rules: Editing Rules | Yes2 |
Business Rules: Initialization Rules | Yes |
Business Rules: Read Only Rules | No |
Business Rules: Required Rules | Yes2 |
Business Rules: Validation Rules | Yes |
Client Expressions | No |
Object Permissions | No |
Services | No |
LDAP | No |
Mobile | No |
Quick Actions (except UI Quick Actions) | Yes |
UI Quick Actions | No |
Reports | Yes |
Search/Dashboard without field references | No |
Search/Dashboard with field references | No |
1. Not fully supported in calculation rules that have a condition of After Save or the Also Recalculate on Load option selected. It may fail if the rule's field is used in a grid, form, or saved search. 2. Except when this field appears on a form or is triggered by such a field. |
Parameters
Parameter | Description |
---|---|
inputDateTime | The datetime you want to format. |
formatSpecifier |
Datetime format (example: SHORTDATE, SHORTTIME, LONGDATE, SHORTDATETIME, LONGDATETIME, SORTABLEDATETIME, DAY, DAYWITHLEADING0, DAYOFWEEKSHORT, DAYOFWEEKLONG, MONTHNUMBER, MONTHNAME, YEARSHORT, YEARLONG, HOUR12HOUR, HOUR12HOURWITHLEADING0, HOUR24HOUR, MINUTE, MINUTEWITHLEADING0, AMPM, CUSTOM). |
customFormat |
(Optional) Flag for custom format. Default value is false. |
timeZone |
(Optional) Flag for returning result in base64 format. Default value is false. |
Return Value
Formatted DateTime value
Example
$(FormatDateTime(CurrentDateTime(), "SHORTTIME", "NA", "Asia/Kolkata"))
Returns this value:
2:27 PM
The value changes according to current time.