Main Content


Determine if input is datetime array



tf = isdatetime(t) returns logical 1 (true) if t is a datetime array. Otherwise, it returns logical 0 (false).


collapse all

Define an array.

A = [datetime('now');datetime('tomorrow');datetime(2016,1,15)]
A = 3x1 datetime
   13-Feb-2024 00:04:28
   14-Feb-2024 00:00:00
   15-Jan-2016 00:00:00

Determine if the array is a datetime array.

tf = isdatetime(A)
tf = logical

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array. t can be any data type.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Thread-Based Environment
Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Version History

Introduced in R2014b