<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
Expression to Reformat the Date Field
Lifecycle Management
Okta Classic Engine
Okta Identity Engine
Overview

Changing the date format from MM/DD/YYYY to YYYY-MM-DD might cause some errors or unexpected results.

Applies To
  • User Lifecycle Management
  • Okta Expression Language
Cause

This expression will achieve the format change:

Time.fromIso8601ToString((Time.fromStringToIso8601(appuser.extensionAttribute4,"MM/DD/YYYY")),"YYYY-MM-DD")

Please consider that it always changes the month to 01, regardless of the month number coming from the Active Directory.

Solution

Multiple syntax solutions are available, including these two examples:

  1. Change both instances of the upper case "MM" in the expression to lower case "mm" while keeping "DD" and "YYYY" the same.
    • Time.fromIso8601ToString((Time.fromStringToIso8601(appuser.extensionAttribute4,"mm/DD/YYYY")),"YYYY-mm-DD")
  2. Keep the "MM" instances the same and change the "DD" and "YYYY" instances to "dd" and "yyyy".
    • Time.fromIso8601ToString((Time.fromStringToIso8601(appuser.extensionAttribute4,"MM/dd/yyyy")),"yyyy-MM-dd")


Related References

Loading
Expression to Reformat the Date Field