JD = 1×3
2457629.92041667 2457660.92041667 2457690.92041667
Compare JDZ and JD. The differences are equal to the time zone offset between UTC and
the America/New_York time zone in fractional days.
JDZ - JD
ans = 1×3
0.166666666511446 0.166666666511446 0.166666666511446
Convert Zoned and Unzoned Datetime Values to POSIX Times
The POSIX time is the number of seconds (including fractional seconds) elapsed since
00:00:00 1-Jan-1970 UTC (Universal Coordinated Time), ignoring leap seconds. To
convert datetime arrays to POSIX times, use the posixtime function.
Create a datetime array and specify its time zone.
DZ = datetime('2016-07-29 10:05:24') + calmonths(1:3);
DZ.TimeZone = 'America/New_York'
DZ = 1x3 datetime array
29-Aug-2016 10:05:24 29-Sep-2016 10:05:24 29-Oct-2016 10:05:24
Convert D to the equivalent POSIX times.
PTZ = posixtime(DZ)
PTZ = 1×3
1472479524 1475157924 1477749924
Create an unzoned copy of DZ. Convert D to the equivalent POSIX times. As D has no time
zone, posixtime treats the times as UTC times.
D = DZ;
D.TimeZone = '';
PT = posixtime(D)
7 Dates and Time