MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
A = datetime(2014,09,01,16,0,0,'TimeZone','America/Los_Angeles',...
'Format','dd-MMM-yyyy HH:mm:ss Z')

A = datetime
01-Sep-2014 16:00:00 -0700

B = datetime(2014,09,01,17,0,0,'TimeZone','America/New_York',...
'Format','dd-MMM-yyyy HH:mm:ss Z')

B = datetime
01-Sep-2014 17:00:00 -0400

A < B

ans = logical
0

4:00 p.m. in Los Angeles occurs after 5:00 p.m. on the same day in New York.

Compare Durations

Compare two duration arrays.

A = duration([2,30,30;3,15,0])

A = 2x1 duration array
02:30:30
03:15:00

B = duration([2,40,0;2,50,0])

B = 2x1 duration array
02:40:00
02:50:00

A >= B

ans = 2x1 logical array

0
1

7 Dates and Time

Free download pdf