Skip to content

Commit 6439c23

Browse files
OKTA-825162 - Merge time function examples into existing table
Fold the new examples directly into the Time functions table (matching the multi-row pattern used elsewhere in this doc) instead of a separate subsection.
1 parent 14bb11b commit 6439c23

1 file changed

Lines changed: 11 additions & 18 deletions

File tree

  • packages/@okta/vuepress-site/docs/reference/okta-expression-language

packages/@okta/vuepress-site/docs/reference/okta-expression-language/index.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -286,29 +286,22 @@ Time functions take their input in the form of strings. Inputting empty strings
286286
| `Time.now` | (String timeZoneId, String format) | String | `Time.now()` | 2015-07-31T17:18:37.979Z (Current time, UTC format) |
287287
| | | | `Time.now("EST")` | 2015-07-31T13:30:49.964-04:00 (Specified time zone) |
288288
| | | | `Time.now("EST", "YYYY-MM-dd HH:mm:ss")` | 2015-07-31 13:36:48 (Specified time zone and format, military time) |
289-
| `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) |
290-
| `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). |
291-
| `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) |
292-
| `Time.fromIso8601ToWindows` | (String time) | String | ISO 8601 timestamp time as a string | The time expressed in Windows timestamp format |
293-
| `Time.fromIso8601ToUnix` | (String time) | String | ISO 8601 timestamp time as a string | The time expressed in Unix timestamp format |
294-
| `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 |
289+
| `Time.fromWindowsToIso8601` | (String time) | String | `Time.fromWindowsToIso8601("130000000000000000")` | 2012-12-14T23:06:40.000Z (Windows/LDAP timestamp converted to ISO 8601) |
290+
| | | | `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`) |
291+
| `Time.fromUnixToIso8601` | (String time) | String | `Time.fromUnixToIso8601("1491868800")` | 2017-04-11T00:00:00.000Z (Unix timestamp converted to ISO 8601) |
292+
| `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) |
293+
| `Time.fromIso8601ToWindows` | (String time) | String | `Time.fromIso8601ToWindows("2017-04-11T00:00:00.000Z")` | 131363424000000000 (ISO 8601 timestamp converted to Windows timestamp format) |
294+
| `Time.fromIso8601ToUnix` | (String time) | String | `Time.fromIso8601ToUnix("2017-04-11T00:00:00.000Z")` | 1491868800 (ISO 8601 timestamp converted to Unix timestamp format) |
295+
| | | | `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`) |
296+
| `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) |
297+
| | | | `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`) |
295298

296299
> **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.
297300
298-
Okta supports the use of the time zone IDs and aliases listed in [the Time zone codes table](#appendix-time-zone-codes).
299-
300-
#### Time function examples
301-
302-
The following examples show common ways to use time functions, such as reformatting dates, converting timestamps from other systems, and using dates in group rules.
303-
304-
| Use case | Expression | Example output |
305-
| --- | --- | --- |
306-
| Convert a date string from `yyyy-MM-dd` format to `MM/dd/yyyy` format.<br>Given `user.hireDate` = `2017-04-11` | `Time.fromIso8601ToString(Time.fromStringToIso8601(user.hireDate, "yyyy-MM-dd"), "MM/dd/yyyy")` | `04/11/2017` |
307-
| Convert the Active Directory `accountExpires` attribute (a Windows timestamp) to a readable date, and return an empty string for accounts that never expire (`accountExpires` = `9223372036854775807`).<br>Given `appuser.accountExpires` = `130000000000000000` | `appuser.accountExpires != "9223372036854775807" ? Time.fromIso8601ToString(Time.fromWindowsToIso8601(appuser.accountExpires), "dd-MM-yyyy") : ""` | `14-12-2012` |
308-
| Convert a date string in `yyyy-MM-dd` format to a Unix timestamp.<br>Given `user.hireDate` = `2017-04-11` | `Time.fromIso8601ToUnix(user.hireDate + "T00:00:00.000Z")` | `1491868800` |
309-
310301
> **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`.
311302
303+
Okta supports the use of the time zone IDs and aliases listed in [the Time zone codes table](#appendix-time-zone-codes).
304+
312305
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:
313306

314307
1. Create a custom Boolean attribute on the user profile, for example, `createdAfterCutoff`.

0 commit comments

Comments
 (0)