How to assign UTC time?
Mostrar comentarios más antiguos
I have a timetable with data that has UTC +1 as timebase. Matlab provides the function timezones, which nicely shows the region, UTC offset and DST (daylight saving time) options. The data set does not have DST. I noticed that there is a region called "etc.", which doesn't include DST. For example, etc/GMT+1. To my surprise, the UTC offset is -1 and not +1 as I'd expect for, well, GMT +1. Why is it defined in the opposite way? When I look up GMT+1 and UTC+1, they should be the same, shouldn't they? So basically I have two questions: 1 Why does the timezone etc/GMT+1 have a negative UTC offset in Matlab? 2 What is the correct way to assign UTC+1 as timezone to a dataset in a timetable? Is this via etc/GMT-1?
Respuesta aceptada
Más respuestas (1)
Jan
el 16 de Mzo. de 2017
0 votos
For the first part: Obviously "UTC offset" is the number, which must be added to the times to get the UTC time.
2 comentarios
Marcel Geers
el 16 de Mzo. de 2017
Peter Perkins
el 16 de Mzo. de 2017
timezones reports that Europe/Amsterdam has an offset of +1. So if you take a UTC timestamp, and add an hour to it, you'll get Amsterdam time. Or equivalently, If you take a UTC timestamp and convert it to Amsterdam time, it looks like you added an hour:
>> d = datetime('now','TimeZone','UTC')
d =
datetime
16-Mar-2017 22:06:01
>> d.TimeZone = 'Europe/Amsterdam'
d =
datetime
16-Mar-2017 23:06:01
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!