Avoid datetime changes due to saving daylight
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Luca D'Angelo
le 5 Jan 2021
Commenté : Luca D'Angelo
le 5 Jan 2021
Good morning,
I have a timeserie from a .xlsx file. I import dates as datetime variable. All data are collected as solar time.
D=readtable(fullfile(path,file),opt,"UseExcel",false); %import a matrix
D.Properties.VariableNames{1}='Date'; %the first column are dates and read as datetime
D.Date.Format='dd/MM/yyyy HH:mm';
D.Date.TimeZone='Europe/Rome';
Unfortunatly, on March, 25th 2007 there was the shift from solar time (maybe in english is more correct refers to this as 'winter time') to legal time (maybe 'saving daylight time'). MATLAB, shift hours as follow:
Input datetime (original) datetime shifted by matlab
24/03/2007 22:00 24/03/2007 22:00
24/03/2007 23:00 24/03/2007 23:00
25/03/2007 00:00 25/03/2007 00:00
25/03/2007 01:00 25/03/2007 01:00
25/03/2007 02:00 25/03/2007 03:00
25/03/2007 03:00 25/03/2007 03:00
25/03/2007 04:00 25/03/2007 04:00
25/03/2007 05:00 25/03/2007 05:00
How could I avoid it and keep the original datetime?
2 commentaires
Walter Roberson
le 5 Jan 2021
The input entries you show on the left: What time UTC do each of them represent? What time local do you want them changed to?
Réponse acceptée
Eric Sofen
le 5 Jan 2021
Do you need to use time zones in your app? In MATLAB, you can work with "unzoned" datetimes, where Daylight Saving Time doesn't show up at all.
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!