Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,28 @@ Time functions take their input in the form of strings. Inputting empty strings
| `Time.now` | (String timeZoneId, String format) | String | `Time.now()` | 2015-07-31T17:18:37.979Z (Current time, UTC format) |
| | | | `Time.now("EST")` | 2015-07-31T13:30:49.964-04:00 (Specified time zone) |
| | | | `Time.now("EST", "YYYY-MM-dd HH:mm:ss")` | 2015-07-31 13:36:48 (Specified time zone and format, military time) |
| `Time.fromWindowsToIso8601` | (String time) | String | Windows timestamp time as a string (Windows/LDAP timestamp doc) | The time expressed in ISO 8601 format (specifically the RFC 3339 subset of the ISO standard) |
| `Time.fromUnixToIso8601` | (String time) | String | Unix timestamp time as a string (Unix timestamp reference) | The time expressed in ISO 8601 format (specifically the RFC 3339 subset of the ISO standard). |
| `Time.fromStringToIso8601` | (String time, String format) | String | Timestamp time in a human-readable yet machine-parseable arbitrary format (as defined by the [Joda time pattern](https://www.joda.org/joda-time/key_format.html)) | The time expressed in ISO 8601 format (specifically the RFC 3339 subset of the ISO standard) |
| `Time.fromIso8601ToWindows` | (String time) | String | ISO 8601 timestamp time as a string | The time expressed in Windows timestamp format |
| `Time.fromIso8601ToUnix` | (String time) | String | ISO 8601 timestamp time as a string | The time expressed in Unix timestamp format |
| `Time.fromIso8601ToString` | (String time, String format) | String | ISO 8601 timestamp time converted to format using the same [Joda time pattern](https://www.joda.org/joda-time/key_format.html) semantics as fromStringToIso8601 | The time expressed in Joda timestamp format |
| `Time.fromWindowsToIso8601` | (String time) | String | `Time.fromWindowsToIso8601("130000000000000000")` | 2012-12-14T23:06:40.000Z (Windows/LDAP timestamp converted to ISO 8601) |
| | | | `appuser.accountExpires != "9223372036854775807" ? Time.fromIso8601ToString(Time.fromWindowsToIso8601(appuser.accountExpires), "dd-MM-yyyy") : ""` (Convert the Active Directory `accountExpires` attribute to a readable date, and return an empty string for accounts that never expire) | 14-12-2012 (Given `appuser.accountExpires` = `130000000000000000`) |
| `Time.fromUnixToIso8601` | (String time) | String | `Time.fromUnixToIso8601("1491868800")` | 2017-04-11T00:00:00.000Z (Unix timestamp converted to ISO 8601) |
| `Time.fromStringToIso8601` | (String time, String format) | String | `Time.fromStringToIso8601("2017-04-11", "yyyy-MM-dd")` | 2017-04-11T00:00:00.000Z (Human-readable date converted to ISO 8601, using [Joda time pattern](https://www.joda.org/joda-time/key_format.html) letters) |
| `Time.fromIso8601ToWindows` | (String time) | String | `Time.fromIso8601ToWindows("2017-04-11T00:00:00.000Z")` | 131363424000000000 (ISO 8601 timestamp converted to Windows timestamp format) |
| `Time.fromIso8601ToUnix` | (String time) | String | `Time.fromIso8601ToUnix("2017-04-11T00:00:00.000Z")` | 1491868800 (ISO 8601 timestamp converted to Unix timestamp format) |
| | | | `Time.fromIso8601ToUnix(user.hireDate + "T00:00:00.000Z")` (Convert a `yyyy-MM-dd` date string, such as a hire date, to a Unix timestamp) | 1491868800 (Given `user.hireDate` = `2017-04-11`) |
| `Time.fromIso8601ToString` | (String time, String format) | String | `Time.fromIso8601ToString("2017-04-11T00:00:00.000Z", "MM/dd/yyyy")` | 04/11/2017 (ISO 8601 timestamp converted to a Joda-pattern format) |
| | | | `Time.fromIso8601ToString(Time.fromStringToIso8601(user.hireDate, "yyyy-MM-dd"), "MM/dd/yyyy")` (Reformat a date string, such as a hire date, from `yyyy-MM-dd` to `MM/dd/yyyy`) | 04/11/2017 (Given `user.hireDate` = `2017-04-11`) |

> **Note**: Both input parameters are optional for the Time.now function. The time zone ID supports both new and old style formats, listed previously. The third example for the Time.now function shows how to specify the military time format.

> **Note:** Date format patterns are case-sensitive. Okta EL uses [Joda time pattern](https://www.joda.org/joda-time/key_format.html) letters, where, for example, `MM` (month) differs from `mm` (minute), and `dd` (day of month) differs from `DD` (day of year). Mixing up the case can produce unexpected results, such as the month always resolving to `01`.

Okta supports the use of the time zone IDs and aliases listed in [the Time zone codes table](#appendix-time-zone-codes).

Time functions aren't supported directly in [group rule conditions](#conditional-expressions). To assign users to a group based on a date comparison, compute the result during profile mapping, then reference the mapped attribute in the group rule:

1. Create a custom Boolean attribute on the user profile, for example, `createdAfterCutoff`.
2. Map the attribute from the source app using a conditional expression that compares dates, for example: `Time.fromIso8601ToWindows(appuser.whenCreated) >= Time.fromIso8601ToWindows("2022-01-01T00:00:00.000Z") ? true : false`
3. Reference the mapped attribute in the group rule: `user.createdAfterCutoff == true`

### Manager/assistant functions

| Function | Description | Example |
Expand Down