Main Content

isdatetime

Determine if input is datetime array

Description

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

example

Examples

collapse all

Define an array.

A = [datetime('now');datetime('tomorrow');datetime(2016,1,15)]
A = 3x1 datetime
   05-Sep-2024 15:40:20
   06-Sep-2024 00:00:00
   15-Jan-2016 00:00:00

Determine if the array is a datetime array.

tf = isdatetime(A)
tf = logical
   1

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