Skip to main content

Relative time/dates

Using relative time/dates​

All date and time parameters accept a full date, i.e. 2020-03-31 10:00:00. Common variations of datetime formats are accepted, however normally it is very tedious to have to enter in the full date and timestamp when searching for data.

To make life easier, all date and time parameters also accept a relative time format, which will be translated for you to the full datetime.

Formats​

The following shows some examples of which kinds of relative time formats are accepted.

Relative TimeMeaning
0sNow
-100ms100 milliseconds ago
-10m10 minutes ago
10m10 minutes from now
-1h1 hour ago
-1h20min1 hour and 20 minutes ago
-14d14 days ago
-6months6 months ago
-12mo12 months ago
-2y2 years ago
-30h+30min29 hours and 30 minutes ago

The relative time and dates is supported in any commands which have the following parameter names.

PSc8yc8y
-DateFrom--dateFrom
-DateTo--dateTo
-Time--time

Example 1: Get a list of FAILED operations in the last day​

c8y operations list --dateFrom "-1d" --status FAILED