How to assign UTC time?
이전 댓글 표시
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?
채택된 답변
추가 답변 (1개)
Jan
2017년 3월 16일
0 개 추천
For the first part: Obviously "UTC offset" is the number, which must be added to the times to get the UTC time.
댓글 수: 2
Marcel Geers
2017년 3월 16일
Peter Perkins
2017년 3월 16일
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
카테고리
도움말 센터 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!