Skip to content

Date

This module contains step implementations for the Date task.

Then date

Then parse date "{value}" and save in variable "{variable}"

[view_source]

Create an instance of the Date task.

Parses a datetime string and transforms it according to specified arguments.

See Date task documentation for more information about arguments.

This step is useful when changes has to be made to a datetime representation during an iteration of a scenario.

Example:

...
And value for variable "date1" is "none"
And value for variable "date2" is "none"
And value for variable "date3" is "none"
And value for variable "AtomicDate.test" is "now"

Then parse date "2022-01-17 12:21:37 | timezone=UTC, format="%Y-%m-%dT%H:%M:%S.%f", offset=1D" and save in variable "date1"
Then parse date "{{ AtomicDate.test }} | offset=-1D" and save in variable "date2"
Then parse date "{{ datetime.now() }} | offset=1Y" and save in variable "date3"

Arguments:

  • value str - datetime string and arguments
  • variable str - name of, initialized, variable where response will be saved in