Datetime formats

Specify a custom format when you convert a datetime value to a string value by using the predefined formats available in Automation Workspace.

The To string action enables you to convert a datetime value to a string value. This action also enables you to select a predefined datetime format or specify a custom format.

Predefined datetime format

When you convert a datetime value to a string value, the predefined datetime formats are available in the Formats list. The following predefined datetime formats are available:
  • BASIC_ISO_DATE: Converts the datetime value to a yyyymmdd+offset value string value.
  • ISO_LOCAL_DATE: Converts the datetime value to a yyyy-mm-dd string value.
  • ISO_OFFSET_DATE: Converts the datetime value to a yyyy-mm-dd+offset value string value. The offset value indicates the difference between the local time and UTC in hours and minutes.
  • ISO_DATE: Converts the datetime value to a yyyy-mm-dd+offset value or yyyy-mm-dd string value. The system adds an offset value if it is available.
  • ISO_LOCAL_TIME: Converts the datetime value to a hh:mm:ss.SSS string value.
  • ISO_OFFSET_TIME: Converts the datetime value to a hh:mm:ss.SSS+offset value string value. The offset value indicates the difference between the local time and UTC in hours and minutes.
  • ISO_TIME: Converts the datetime value to a hh:mm:ss.SSS, or hh:mm:ss.SSS+offset value string value. The offset value indicates the difference between the local time and UTC in hours and minutes.
  • ISO_LOCAL_DATE_TIME: Converts the datetime value to a yyyy-mm-ddThh:mm:ss.SSS string value.
  • ISO_OFFSET_DATE_TIME: Converts the datetime value to a yyyy-mm-ddThh:mm:ss.SSS+offset value string value. The offset value indicates the difference between the local time and UTC in hours and minutes.
  • ISO_ZONED_DATE_TIME: Converts the datetime value to a yyyy-mm-ddThh:mm:ss.SSS+offset value[zone id] string value. The offset value indicates the difference between the local time and UTC in hours and minutes. The 'zone id' in the format represents the time zone.
  • ISO_DATE_TIME: Converts the datetime value to a yyyy-mm-ddThh:mm:ss.SSS, yyyy-mm-ddThh:mm:ss.SSS+offset value, or yyyy-mm-ddThh:mm:ss.SSS+offset value[zone id] string value.
  • ISO_ORDINAL_DATE: Converts the datetime value to a yyyy-[day of the year], or yyyy-[day of the year]+offset value string value. For example, if the datetime value is 'January 25, 2018', it is formatted as '2018-25' where '25' indicates the day of the year.
  • ISO_WEEK_DATE: Converts the datetime value to a yyyy-[week of the year]-[day of the week], or yyyy-[week of the year]-[day of the week]+offset value string value. For example, if the datetime value is 'January 25, 2018', it is formatted as '2018-W4-4' where 'W4' indicates that it is the fourth week of the year and '4' indicates the day of that week.
  • ISO_INSTANT: Converts the datetime value to a yyyy-mm-ddThh:mm:ss.SSSZ string value.
  • RFC_1123_DATE_TIME: Converts the datetime value to a [day of the week], [day of the month] [month in 'MMM' format] [year in 'YYYY' format] hh:mm:ss, or [day of the week], [day of the month] [month in 'MMM' format] [year in 'YYYY' format] hh:mm:ss+offset value string value. For example, if the datetime value is '2018-01-25 10:15', it is formatted as 'Thu, 25 December 2018 10:15:00GMT'. The 'GMT' indicates that there is no offset available.

Custom datetime format

Use predefined conventions to specify a custom datetime format. The following conventions are available:
Note: All predefined conventions that are used to specify a custom datetime format are case-sensitive.
  • 'y' and 'Y': Specify a year as 'yy' or 'yyyy' and specify the year of the week as 'YY' respectively.
    Note: The ‘yy’ and ‘YY’ provide the same result, however the result differs if you use a datetime format that includes the last week or the first week of a calendar year.

    For example, when you use a datetime format as 12/26/22 (2022/12/26), then perform actions to delete the files from the previous year, the datetime format ‘yy’ provides correct result (12/26/21) and the files from the year 2021 are deleted. If you use the datetime format ‘YY’ (indicating the year of the week in which the specific day appears), then files from the year 2022 will be deleted because the day 12/26/21 falls during the last week of 2021 and also during the first week of 2022.

    Sample calendar

    We recommend that you use the datetime format 'yy' when you want to consider the calendar year only and not a specific week of that calendar year.

  • 'M': Specify a month as 'M', 'MM', 'MMM' (abbreviated name of the month, for example, Jan, Feb), or 'MMMM' (full name of the month, for example, January, February).
    Note: The 'MMM' and 'MMMM' datetime formats work depending on the operating system on which the Bot Agent runs and your location setting.
  • 'd': Specify a day as 'd' or 'dd'.
  • 'D': Specify a day in a year as 'D' or 'DD'.
  • 'E': Specify day of the week as 'EEE' (Sun-Sat) or 'EEEE' (Sunday-Saturday).
    Note: The 'EEE' and 'EEEE' datetime formats work depending on the operating system on which the Bot Agent runs and your location setting.
  • F or FF: Specify day of the week in a month with or without leading zero. For example, yyyy-ww-F or yyyy-ww-0F.
    Note: To specify the day of the week in a month, you can also specify the fixed format as ISO_WEEK_DATE ('2012-W48-6')
  • 'h' or 'H': Specify an hour as 'hh' or 'HH'.
    Note: HH is a 24-hour time format, and hh is a 12-hour time format with AM or PM. When you use the hh format, add a at the end of the datetime format. For example, if the system locale language is English, the input will be 2018-12-25 10:50:55.999 AM and the format will be yyyy-MM-dd hh:mm:ss.SSS a where a indicates AM or PM. However, on computers that use operating systems in languages other than English, use AM or PM marker accordingly. For example, on a Japanese language operating system, the input must have AM or PM marker in Japanese, such as 2018-12-25 10:50:55.999 午前, where 午前 means AM in Japanese, and the format must be yyyy-MM-dd hh:mm:ss.SSS a.
  • 'a': Specify an AM/PM marker for the 12-hour time format
  • 'm': Specify a minute in an hour as 'mm'.
  • 's': Specify a second in a minute as 'ss'.
  • 'S': Specify a millisecond as 'SSS'.
  • 'z': Specify a timezone, such as 'Pacific Standard Time' and 'Indian Standard Time'.
  • 'Z': Specify an offset time for a timezone, such as '+0550' for 'Indian Standard Time'.
Important: On computers where the display language is set to Simplified Chinese or Traditional Chinese, when you use the dd-MMM-yyyy custom datetime format to convert a datetime value to a string value, the output might show incorrectly.
You can use the preceding convention to specify the custom format that you want to use for converting a datetime value. Some examples that use the preceding convention are as follows:
Format Sample output
yyyy-MM-dd 2018-09-30
yyyy-M-d 2020-9-8
dd-MM-yyyy 25-12-2018
yyyy-MM-dd HH:mm:ss 2018-12-25 23:50:55
hh:mm:ss.SSS a 10:15:35.889 AM / 10:15:35.889 PM
yyyy-MM-dd HH:mm:ss.SSS 2018-12-25 23:50:55.999
yyyy-MM-dd HH:mm:ss.SSS Z 2018-12-25 23:50:55.999 +0530
h.mm a 4.10 PM
D 'days', yyyy 365 days, 2019