DateStringToISOFormat
This is a thin wrapper around the `dateutil.parser.parse` function. It will parse a string containing a date/time stamp and return it in ISO 8601 format.
python · Filters And Transformers
Details
| ID | DateStringToISOFormat |
|---|---|
| Language | python |
| From Version | 5.0.0 |
| Docker Image | demisto/python3:3.12.13.10404775 |
| Tags | transformer date |
README
This is a thin wrapper around the dateutil.parser.parse function. It will parse a string containing a date/time stamp and return it in ISO 8601 format.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | transformer, date |
| Cortex XSOAR Version | 5.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| value | Date value to convert. |
| dayfirst | Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. |
| yearfirst | Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. |
| fuzzy | Whether to allow fuzzy parsing, allowing for string like “Today is January 1, 2047 at 8:21:00AM”. |
| add_utc_timezone | Whether to add UTC timezone to the date string returned in case offset-naive date was provided as input. |
Outputs
There are no outputs for this script.
Script Examples
Example command
!DateStringToISOFormat value="'05-11-2929'" dayfirst="true" yearfirst="true" fuzzy="true" add_utc_timezone="false"
Context Example
{}
Human Readable Output
2929-11-05T00:00:00
args: - description: Date value to convert. name: value required: true - auto: PREDEFINED default: true defaultValue: 'true' description: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. name: dayfirst predefined: - 'true' - 'false' - auto: PREDEFINED default: true defaultValue: 'false' description: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. name: yearfirst predefined: - 'true' - 'false' - auto: PREDEFINED default: true defaultValue: 'true' description: Whether to allow fuzzy parsing, allowing for string like "Today is January 1, 2047 at 8:21:00AM". name: fuzzy predefined: - 'true' - 'false' - auto: PREDEFINED defaultValue: 'false' description: Whether to add UTC timezone to the date string returned in case offset-naive date was provided as input. name: add_utc_timezone predefined: - 'true' - 'false' comment: This is a thin wrapper around the `dateutil.parser.parse` function. It will parse a string containing a date/time stamp and return it in ISO 8601 format. commonfields: id: DateStringToISOFormat version: -1 enabled: true name: DateStringToISOFormat script: '-' subtype: python3 tags: - transformer - date timeout: '0' isllm: false type: python dockerimage: demisto/python3:3.12.13.10404775 fromversion: 5.0.0 tests: - No tests (auto formatted)