<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
Convert Active Directory lastLogonTimestamp Format with Okta Expression Language
Okta Classic Engine
Okta Identity Engine
Lifecycle Management
Directories
Overview

This article explains how to convert the Active Directory attribute lastLogonTimestamp to a more readable format using the Okta Expression Language when mapped to the Okta Profile.

Applies To
  • Lifecycle Management
  • Active Directory (AD)
  • lastLogonTime
  • Okta Expression Language (OEL)
Cause

When the AD attribute lastLogonTimestamp is mapped to the Okta Profile, the format is very close to the ISO 8601 date standard but has different formatting representing the milliseconds.

This date is how AD sends the attribute value to Okta.

  • 2023-07-28T22:21:49+0000
This is an example of a date Okta would successfully interpret using the ISO 8601 Expression Language time functions.
  • 2023-08-28T07:00:00.000Z
Solution

The Okta Expression Language (OEL) can convert a date formatted in the ISO 8601 standard to a more readable format using time functions once the date is in the correct format.

  • Use the following OEL to change the milliseconds to match the ISO 8601 date standard before converting the date to a string in a more readable format. Replace "MMM d yyy HH:mm" with the desired format as defined by the Joda time pattern.
    • Time.fromIso8601ToString(String.substringBefore(appuser.lastLogonTimestamp, "+") + ".000Z","MMM d yyy HH:mm")

Related Resources

Loading
Convert Active Directory lastLogonTimestamp Format with Okta Expression Language