remove timezone on timetable in matlab

To remove the timezone from a timetable in MATLAB, you can convert the datetime values within the timetable to a format that does not include a timezone. One way to do this is to use the datestr function.

Here is an example code snippet that removes the timezone from a timetable named tt:

main.m
% convert datetime to string without timezone
tt.Time = datestr(tt.Time, 'yyyy-mm-dd HH:MM:SS');

% create new timetable without timezone
tt_no_tz = timetable(tt.Data, 'RowTimes', datetime(tt.Time, 'InputFormat', 'yyyy-mm-dd HH:MM:SS'));
238 chars
6 lines

In this code, the datestr function is used to convert the Time column of the tt timetable to a string format that includes only the date and time information, but not the timezone. The resulting string is then used to create a new timetable named tt_no_tz, which has the same data as the original tt timetable, but with the timezone removed from the Time column.

gistlibby LogSnag