C.4. Specifying Time Values
When specifying time values for LVM selection, you can use either a standardized time specification format or a more free-form specification, as described in Section C.4.1, “Standard time selection format” and Section C.4.2, “Freeform time selection format”.
You can specify the way time values are displayed with the report/time format configuration option in the
/etc/lvm/lvm.conf
configuration file. Information on specifying this option is provided in the lvm.conf
file.
When specifying time values, you can use the comparison operator aliases
since
, after
, until
, and before
, as described in Table C.3, “Selection Criteria Comparison Operators”.
C.4.1. Standard time selection format
You can specify time values for LVM selection in the following format.
date time timezone
Table C.15, “Time Specification Formats” summarizes the formats you can use when specifying these time values.
Field | Field Value | |||
---|---|---|---|---|
date |
| |||
time |
| |||
timezone (always with + or - sign) |
|
The full date/time specification is YYYY-MM-DD hh:mm:ss. Users are able to leave date/time parts from right to left. Whenever these parts are left out, a range is assumed automatically with second granularity. For example:
- "2015-07-07 9:51" means range of "2015-07-07 9:51:00" - "2015-07-07 9:51:59"
- "2015-07" means range of "2015-07-01 0:00:00" - "2015-07-31 23:59:59"
- "2015" means range of "2015-01-01 0:00:00" - "2015-12-31 23:59:59"
The following examples show the date/time specification as used in selection criteria.
lvs -S 'time since "2015-07-07 9:51"' lvs -S 'time = "2015-07"" lvs -S 'time = "2015"'
C.4.2. Freeform time selection format
You can specify the date/time specification in LVM selection criteria using the following entitles.
- weekday names ("Sunday" - "Saturday" or abbreviated as "Sun" - "Sat")
- labels for points in time ("noon", "midnight")
- labels for a day relative to current day ("today", "yesterday")
- points back in time with relative offset from today (N is a number)
- ( "N" "seconds"/"minutes"/"hours"/"days"/"weeks"/"years" "ago")
- ( "N" "secs"/"mins"/"hrs" ... "ago")
- ( "N" "s"/"m"/"h" ... "ago")
- time specification either in hh:mm:ss format or with AM/PM suffixes
- month names ("January" - "December" or abbreviated as "Jan" - "Dec")
The following examples the show the
freeform
date/time specification as used in selection criteria.
lvs -S 'time since "yesterday 9AM"' lvs -S 'time since "Feb 3 years 2 months ago"' lvs -S 'time = "February 2015"' lvs -S 'time since "Jan 15 2015" && time until yesterday' lvs -S 'time since "today 6AM"'