< Home

time-range

Function

The time-range command sets a time range.

The undo time-range command deletes a time range.

By default, no time range is set.

Format

time-range time-name { start-time to end-time { days } &<1-7> | from time1 date1 [ to time2 date2 ] }

undo time-range time-name [ start-time to end-time { days } &<1-7> | from time1 date1 [ to time2 date2 ] ]

Parameters

Parameter

Description

Value

time-name

Specifies the name of a time range.

The value is a string of case-sensitive characters without spaces and must begin with a letter. The value ranges from 1 to 32. To avoid confusion, do not use "all" as the name of a time range.

start-time

Specify the start time of a time range.

The format is hh:mm.
  • hh specifies the hour. The value is an integer that ranges from 0 to 23.
  • mm specifies the minute. The value is an integer that ranges from 0 to 59.

end-time

Specify the end time of a time range.

The format is hh:mm.
  • hh specifies the hour. The value is an integer that ranges from 0 to 23.
  • mm specifies the minute. The value is an integer that ranges from 0 to 59.

days

Specifies the date on which the time range takes effect.

The value can be one of the following:
  • The numbers 0 to 6 indicate that the time range takes effect from Sunday to Saturday. The number 0 refers to Sunday.
  • A weekday includes Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday.
  • The value "Daily" indicates that the time range takes effect during the seven days in a week.
  • The value "off-day" indicates that the time range takes effect on weekends including Saturday and Sunday.
  • The value "Working-day" indicates that the time range takes effect in five days from Monday to Friday.

from time1 date1

Specifies the time for the time range to take effect.

time1 is in the format of hh:mm.
  • hh specifies the hour. The value is an integer that ranges from 0 to 23.
  • mm specifies the minute. The value is an integer that ranges from 0 to 59.
date1 is in the format of yyyy/mm/dd.
  • yyyy specifies the year. The value is an integer that ranges from 1970 to 2099.
  • mm specifies the month. The value is an integer that ranges from 1 to 12.
  • dd specifies the day. The value is an integer that ranges from 1 to 31.

to time2 date2

Specifies the end of a time range.

The formats time2 and date2 are the same as those of the start time. The end time must be later than the start time. If the end time is not set, the device takes the maximum value allowed by the system.

Views

System view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

If some services or functions need to be started at intervals or periodically, you can run the time-range command to set the time range. When configuring ACL or ACL6 rules, you can reference the names of time ranges.

The time range is classified into the following types:
  • Relative time range (periodic time range): It is specified by start-time and end-time. The weekday when the time range takes effect is determined by days.
  • Absolute time range: It is specified by from and to. The absolute time range can be used to limit the periodic time range.
You can set the same name for multiple time ranges to describe a special period. If multiple time ranges have the same name, the periodic time ranges are ORed, and a periodic time range and a definite time range are ANDed. For example, three time ranges are set with the same name test:
  • Time range 1: 01.01.2010 00:00 to 31.12.2010 23:59 (absolute time range)
  • Time range 2: 8:00 to 18:00 from Monday to Friday (periodic time range)
  • Time range 3: 14:00 to 18:00 on Saturday and Sunday (periodic time range)
The time range test takes effect at 8:00-18:00 on Monday to Friday and 14:00-18:00 on Saturday and Sunday in the year 2010.

Precautions

There may be a time difference of no more than 10 seconds between the configured time range and the time range that actually takes effect.

Example

# Set a time range named test that takes effect from 2010-01-01 00:00 to 2010-12-31 23:59.

<HUAWEI> system-view
[HUAWEI] time-range test from 0:0 2010/1/1 to 23:59 2010/12/31

# Set a time range named test that takes effect at 8:00-18:00 from Monday to Friday.

<HUAWEI> system-view
[HUAWEI] time-range test 8:00 to 18:00 working-day

# Set a time range named test that takes effect from 14:00 to 18:00 on every Saturday and Sunday.

<HUAWEI> system-view
[HUAWEI] time-range test 14:00 to 18:00 off-day
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic