Note: You are looking at a static snapshot of documentation related to Robot Framework automations. The most recent documentation is at https://robocorp.com/docs

DateTime

Adds time to date and returns the resulting date.

Arguments

ArgumentTypeDefault value
datenull
timenull
result_formattimestamp
exclude_millisFalse
date_formatNone

Arguments:

  • date: Date to add time to in one of the supported date formats.
  • time: Time that is added in one of the supported time formats.
  • result_format: Format of the returned date.
  • exclude_millis: When set to any true value, rounds and drops milliseconds as explained in millisecond handling.
  • date_format: Possible custom timestamp format of date.

Examples:

${date} =Add Time To Date2014-05-28 12:05:03.1117 days
Should Be Equal${date}2014-06-04 12:05:03.111
${date} =Add Time To Date2014-05-28 12:05:03.11101:02:03:004
Should Be Equal${date}2014-05-28 13:07:06.115

Adds time to another time and returns the resulting time.

Arguments

ArgumentTypeDefault value
time1null
time2null
result_formatnumber
exclude_millisFalse

Arguments:

  • time1: First time in one of the supported time formats.
  • time2: Second time in one of the supported time formats.
  • result_format: Format of the returned time.
  • exclude_millis: When set to any true value, rounds and drops milliseconds as explained in millisecond handling.

Examples:

${time} =Add Time To Time1 minute42
Should Be Equal${time}${102}
${time} =Add Time To Time3 hours 5 minutes01:02:03timerexclude_millis=yes
Should Be Equal${time}04:07:03

Converts between supported date formats.

Arguments

ArgumentTypeDefault value
datenull
result_formattimestamp
exclude_millisFalse
date_formatNone

Arguments:

  • date: Date in one of the supported date formats.
  • result_format: Format of the returned date.
  • exclude_millis: When set to any true value, rounds and drops milliseconds as explained in millisecond handling.
  • date_format: Specifies possible custom timestamp format.

Examples:

${date} =Convert Date20140528 12:05:03.111
Should Be Equal${date}2014-05-28 12:05:03.111
${date} =Convert Date${date}epoch
Should Be Equal${date}${1401267903.111}
${date} =Convert Date5.28.2014 12:05exclude_millis=yesdate_format=%m.%d.%Y %H:%M
Should Be Equal${date}2014-05-28 12:05:00

Converts between supported time formats.

Arguments

ArgumentTypeDefault value
timenull
result_formatnumber
exclude_millisFalse

Arguments:

  • time: Time in one of the supported time formats.
  • result_format: Format of the returned time.
  • exclude_millis: When set to any true value, rounds and drops milliseconds as explained in millisecond handling.

Examples:

${time} =Convert Time10 seconds
Should Be Equal${time}${10}
${time} =Convert Time1:00:01verbose
Should Be Equal${time}1 hour 1 second
${time} =Convert Time${3661.5}timerexclude_milles=yes
Should Be Equal${time}01:01:02

Returns current local or UTC time with an optional increment.

Arguments

ArgumentTypeDefault value
time_zonelocal
increment0
result_formattimestamp
exclude_millisFalse

Arguments:

  • time_zone: Get the current time on this time zone. Currently only local (default) and UTC are supported.
  • increment: Optional time increment to add to the returned date in one of the supported time formats. Can be negative.
  • result_format: Format of the returned date (see date formats).
  • exclude_millis: When set to any true value, rounds and drops milliseconds as explained in millisecond handling.

Examples:

${date} =Get Current Date
Should Be Equal${date}2014-06-12 20:00:58.946
${date} =Get Current DateUTC
Should Be Equal${date}2014-06-12 17:00:58.946
${date} =Get Current Dateincrement=02:30:00
Should Be Equal${date}2014-06-12 22:30:58.946
${date} =Get Current DateUTC- 5 hours
Should Be Equal${date}2014-06-12 12:00:58.946
${date} =Get Current Dateresult_format=datetime
Should Be Equal${date.year}${2014}
Should Be Equal${date.month}${6}

Subtracts date from another date and returns time between.

Arguments

ArgumentTypeDefault value
date1null
date2null
result_formatnumber
exclude_millisFalse
date1_formatNone
date2_formatNone

Arguments:

Examples:

${time} =Subtract Date From Date2014-05-28 12:05:522014-05-28 12:05:10
Should Be Equal${time}${42}
${time} =Subtract Date From Date2014-05-28 12:05:522014-05-27 12:05:10verbose
Should Be Equal${time}1 day 42 seconds

Subtracts time from date and returns the resulting date.

Arguments

ArgumentTypeDefault value
datenull
timenull
result_formattimestamp
exclude_millisFalse
date_formatNone

Arguments:

  • date: Date to subtract time from in one of the supported date formats.
  • time: Time that is subtracted in one of the supported time formats.
  • result_format: Format of the returned date.
  • exclude_millis: When set to any true value, rounds and drops milliseconds as explained in millisecond handling.
  • date_format: Possible custom timestamp format of date.

Examples:

${date} =Subtract Time From Date2014-06-04 12:05:03.1117 days
Should Be Equal${date}2014-05-28 12:05:03.111
${date} =Subtract Time From Date2014-05-28 13:07:06.11501:02:03:004
Should Be Equal${date}2014-05-28 12:05:03.111

Subtracts time from another time and returns the resulting time.

Arguments

ArgumentTypeDefault value
time1null
time2null
result_formatnumber
exclude_millisFalse

Arguments:

  • time1: Time to subtract another time from in one of the supported time formats.
  • time2: Time to subtract in one of the supported time formats.
  • result_format: Format of the returned time.
  • exclude_millis: When set to any true value, rounds and drops milliseconds as explained in millisecond handling.

Examples:

${time} =Subtract Time From Time00:02:30100
Should Be Equal${time}${50}
${time} =Subtract Time From Time${time}1 minutecompact
Should Be Equal${time}- 10s