NaT
Not-a-Time: the missing value of datetime arrays.
Category: Language Fundamentals > Data Types
Syntax
t = NaT
A scalar missing datetime.
t = NaT(sz1, ..., szN)
An array of missing datetimes with the given size.
Description
NaT plays for datetime values the role that NaN plays for numbers. It is displayed as NaT, propagates through arithmetic, and is unequal to everything. Every comparison with a NaT is false, except ~=.
Use isnat to find the missing elements, since t == NaT is always false.
Input arguments
sz1, ..., szN- Non-negative integers giving the size.
Output arguments
t- Array of class
datetimewhose elements are allNaT.
Example
NaT(1, 2)
isnat([NaT datetime(2024,1,1)])
datetime(2024,1,1) > NaT
Output
ans = 1×2 datetime array
NaT NaT
ans = 1×2 logical array
1 0
ans = logical
0