Skip to content

Timestamp

Report name: timestamp

Available in all: Yes

Report that prints Robocop execution timestamp.

Timestamp follows local time in the format of Year-Month-Day Hours(24-hour clock):Minutes:Seconds ±hh:mm UTC offset as default.

Example:

Reported: 2022-07-10 21:25:00 +0300

Enable with:

robocop check --reports timestamp
[tool.robocop.lint]
reports = [
    "timestamp"
]

You can also enable it by using all which enables all reports that supports all option:

robocop check --reports all
[tool.robocop.lint]
reports = [
    "all"
]

Configuration

Timezone

Configure timezone to be used in timestamp report with timezone parameter:

robocop check --reports timestamp --configure timestamp.timezone="Europe/Paris"
[tool.robocop.lint]
reports = [
    "timestamp"
]
configure = [
    "timestamp.timezone=Europe/Paris"
]

For timezone names, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

Format

Configure a timestamp format with format parameter:

robocop check --reports timestamp --configure timestamp.format="%Y-%m-%d %H:%M:%S %Z %z"
[tool.robocop.lint]
reports = [
    "timestamp"
]
configure = [
    "timestamp.format=%Y-%m-%d %H:%M:%S %Z %z"
]

For timestamp formats, see datetime format codes.

Useful configurations

Local time to ISO 8601 format:

robocop check --configure timestamp.format="%Y-%m-%dT%H:%M:%S%z"

UTC time:

robocop check --configure timestamp.timezone="UTC" --configure timestamp.format="%Y-%m-%dT%H:%M:%S %Z %z"

Timestamp with high precision:

robocop check --configure timestamp.format="%Y-%m-%dT%H:%M:%S.%f %z"

12-hour clock:

robocop check --configure timestamp.format="%Y-%m-%d %I:%M:%S %p %Z %z"

More human-readable format 'On 10 July 2022 07:26:24 +0300':

robocop check --configure timestamp.format="On %d %B %Y %H:%M:%S %z"