datetime.isdst
datetime: TF = isdst (T)
Determine which datetime values fall in daylight saving time.
TF = isdst (T) returns a logical array TF of the
same size as the input datetime array T, where each element is
true if the corresponding datetime falls within daylight saving
time in its time zone, and false otherwise. If T has no
time zone, or for Not-A-Time (NaT) values, the corresponding
element of TF is false.
Source Code: datetime
isdst is true where an element falls in daylight saving time. For a New York datetime that is false in January and true in July.
t = datetime (2024, [1, 7], 15, 'TimeZone', 'America/New_York')
t =
1x2 datetime array
15-Jan-2024 15-Jul-2024
isdst (t)
ans = 0 1