isdatetime
Tests whether a value is a datetime array.
Category: Language Fundamentals > Data Types
Syntax
tf = isdatetime(A)
Returns true for a datetime array.
Description
Only values of class datetime pass. Date strings, serial date numbers from datenum and duration values are not datetime; convert them with datetime(...) first.
Input arguments
A- Any value.
Output arguments
tf- Logical scalar.
Example
Datetime or not
isdatetime(datetime(2024, 1, 5))
isdatetime('2024-01-05')
isdatetime(hours(3))
Output
ans = logical
1
ans = logical
0
ans = logical
0