# isregular

Determine if input times are regular with respect to time or calendar unit

## Description

returns `tf`

= isregular(`D`

)`1`

(`true`

) if `D`

is
*regular* with respect to time. Otherwise, it returns
`0`

(`false`

). The input `D`

is regular if its times are in a sequence that is strictly monotone (either
increasing or decreasing) with a unique time step.

The input argument `D`

can be a:

`datetime`

vector.`duration`

vector.Timetable. It is regular if its vector of row times is regular.

This syntax is equivalent to `isregular(D,'time')`

.

determines if `tf`

= isregular(`D`

,`timeUnit`

)`D`

is regular with respect to the specified time or
calendar unit.

For example, `D`

might be regular with respect to months, but
irregular with respect to exact elapsed time because different months can have
different numbers of days. To determine if `D`

is regular with
respect to months, specify `timeUnit`

as
`'months'`

.

## Examples

## Input Arguments

## Output Arguments

## Tips

In certain cases, you can create a timetable or

`datetime`

vector while specifying a regular time step, and yet the result is irregular. Such a result can occur when you specify the time step by using a calendar unit of time and there is a time that introduces an irregular step. For example, if you create a timetable with a time step of one calendar month, starting on January 31, 2019, then it is irregular with respect to months.stime = datetime(2019,1,31); tstep = calmonths(1); TT = timetable('Size',[3 1],'VariableTypes',{'double'},... 'TimeStep',tstep,'StartTime',stime); tf = isregular(TT,'month')

tf = logical 0

There are other cases where irregularities are due to shifts from Daylight Saving Time (DST) or to

`datetime`

values that are leap seconds. This table specifies the dates, times, and time steps that can produce irregular results unexpectedly.Row Time Value

Time Step

Start time specified as the 29th, 30th, or 31st day of the month.

Number of calendar months or quarters.

Start time specified as February 29.

Number of calendar years.

Any `datetime`

value occurring between 1:00 a.m. and 2:00 a.m. on a day shifting from DST to standard time (when such values have a time zone that observes DST).Number of calendar days or months. Any

`datetime`

value that is a leap second (when the time zone for such values is the`UTCLeapSeconds`

time zone). For the list of leap seconds, see`leapseconds`

.Time step specified in any calendar unit (days, weeks, months, quarters, or years).

## Extended Capabilities

## Version History

**Introduced in R2016b**