ToLocal

Converts a DateTime value to the local date and time in a time zone.

If you execute this function with both parameters, it returns the local date and time in the time zone that you specify.

If you execute this function without the timeZone parameter, it returns the local date and time in the time zone associated with the current session.

If you execute this funtion with no parameters, it returns the current local date and time associated with the current session.

Syntax

ToLocal(utcDateTime, 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) Yes
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) Yes
Business Rules: Editing Rules Yes1
Business Rules: Initialization Rules Yes
Business Rules: Read Only Rules No
Business Rules: Required Rules Yes1
Business Rules: Validation Rules Yes
Client Expressions No
Object Permissions No
Services Yes
LDAP Yes
Mobile Yes
Quick Actions (except Export to Microsoft Excel Quick Action and UI Quick Actions) Yes
UI Quick Actions No
Reports Yes
Search/Dashboard without field references Yes
Search/Dashboard with field references No
1. Except when this field appears on a form or is triggered by such a field.  

Parameters

Parameter Description
utcDateTime (Optional) A UTC DateTime value to convert to the local date and time. The default is the current date and time.
timeZone

(Optional) The time zone, in IANA format.

Return Value

DateTime value.

If the application has to display the return value, it implicitly converts it to text, thereby allowing the display format to change depending on your culture code. See Available Languages and Cultures for a list of the culture codes used by Neurons for ITSM.

Example

$(ToLocal(CurrentDateTime()))

The above example returns the current local date and time. (The CurrentDateTime() function returns the current date and time in UTC, and then the ToLocal() function converts it to the current local date and time.)

Related Topics Link IconRelated Topics