Matlab's method of converting date and time data with time zone and date and time data without time zone to each other

Using datetime and datetimezone functions

By using the datetime and datetimezone functions, you can convert datetime data with a time zone to data without a time zone, or convert datetime data without a time zone to data with a time zone. This meets the configuration requirements for the axes.

1. Convert date and time data with time zone to data without time zone

datetimezone_with = datetime('2022-01-01 10:00:00', 'TimeZone', 'America/New_York');
datetime_without = datetime(datetimezone_with, 'TimeZone', 'UTC');

2. Convert date and time data without time zone to data with time zone

datetime_without = datetime('2022-01-01 10:00:00', 'TimeZone', 'UTC');
datetimezone_with = datetime(datetime_without, 'TimeZone', 'America/New_York');

Guess you like

Origin blog.csdn.net/weixin_45770896/article/details/134850075