Extract DateTime

You can use this step to convert the textual representation of a Date, Time, or DateTime value into a Date, Time, or DateTime value. The step can be inserted both from the Recorder View and directly from the Robot workflow. We recommend that you insert it from the Recorder View by right-clicking the element to extract, clicking Extract Value From > Text Into, and selecting the DateTime variable to store the extracted value in. In this case, most of the configuration steps, such as determining the extraction pattern and the target type, will be done automatically.

Properties

Target Type

The result type to extract the Date, Time, or DateTime value to. The converted value is stored in the $current variable.

Default Date
Only shown if the Target Type is set to DateTime. A default date to use if the pattern is a time pattern.
  • No Date: No default date is provided. When selected, if the robot does not find any date to extract, the extraction fails.

  • Current Date: When selected, if no date was extracted, the current date is provided.

  • Calculated: When selected, if no date was extracted, an expression is used to compute the date, such as a variable or a function.

The Default Date property can be useful in situation where a web page or an application contains one date and multiple instances of time associated with that date. In this case, you can first extract the date into a variable and then extract the time instances using the date variable as the default date. Each extracted time will be a DateTime value with the date part corresponding to the date that was initially extracted.

Time Zone
Only shown if the Target Type is set to DateTime. A time zone to use in the extracted DateTime value.
  • Default: If the time zone is found for extraction, it is used. If no time zone is found, the time zone where the robot is being executed is used instead.

  • Zone ID: A set of predefined time zone IDs to choose from, such as “Europe/Rome,” “America/Los_Angeles,” “CET,” “Universal,” and so on.

  • Offset: A set of predefined zone offsets to choose from, such as "Z," "+01:00," "-08:00," and so on.

  • Calculated: A way to get the time zone from a constant or an expression. This time zone can be either a zone ID or an offset. It can be the same as the predefined time zones, but the Calculated option also provides additional formats, such as “+1,” “-08:30:15,” and so on.

Pattern
Various formats that can be used for extracting the Date, Time, or DateTime value.
  • Predefined: Standard extraction formats based on various date formats, such as ISO. You can find a complete list of predefined formats on the docs.oracle.com website.

  • Default Patterns: A set of commonly used patters to choose from, such as yyyy-M-d. Note that selecting a Target Type has effect on which patterns will be available on this list.

  • Calculated: A pattern that you can create as a constant or with an expression. This option provides the same formats as the Default Patterns option. The patterns consist of letters and combinations of letters, each corresponding to parts of a date, as shown in the following table.

    Letter Description Example
    z time zone ID z, zz, and zzz match CET; zzzz matches both CET and Central European Time
    Z time zone offset Z, ZZ, and ZZZ match +0100; ZZZZ matches GMT+01:00; ZZZZZ matches +01:00
    y year yyyy matches 2022; yy matches 22
    M month M matches 7 or 07; MM matches 07; MMM matches Jul; and MMMM matches July
    d day d matches 1 or 01; dd matches 01
    E day of week EEE matches Mon; EEEE matches Monday
    h hour of clock (1 -12 AM or PM) H matches 0 or 23; h and hh match 01 or 12 and usually require an a pattern for AM or PM
    a AM or PM a matches AM or pm
    m minutes mm matches 00 or 43
    s seconds ss matches 00 or 43
    S fraction of second SSS matches 123

    Also note:

    • Patterns can contain characters such as "-" (hyphen), "/" (slash), and space to separate parts of a date.
    • You can include text in a pattern by enclosing it in single quotation marks.
    • The count of pattern letters determines the result format. For example, with digits, if the count of letters is one, the result would contain any number of digits (d may result in 1, 01 or 31). Otherwise, the count describes the width of the result, such as with month names: a count of three denotes a short form (Jul) and a count of four denotes a full form (July).

      For more information, see the docs.oracle.com website.

Locale
Contains a list of the available locales. A locale specifies a given language and a region that must be separated by a hyphen ("en-US"). As different languages use different approaches to identify a date, you can use this option to take language specifics into account, such as month names.

Note that time zones are not affected by the locales.