フィルターのクリア

how to convert data in UTC to a specific local time

127 ビュー (過去 30 日間)
Saeed Bello
Saeed Bello 2016 年 8 月 24 日
コメント済み: Saeed Bello 2016 年 8 月 26 日
I have a one-year hourly data in UTC time. How do I convert the data to a specific local time say for example -5 UTC.
  1 件のコメント
Adam
Adam 2016 年 8 月 24 日
What format do you have the data in?

サインインしてコメントする。

採用された回答

Peter Perkins
Peter Perkins 2016 年 8 月 25 日
UTC-5 is likely NOT your local time zone, since most locales shift for daylight saving. That's a detail many people forget.
You may be starting from timestamps in the form of text. If you use datetime, converting from UTC to local time is as easy as setting the TimeZone property, and datetime automatically accounts for daylight saving changes:
>> d = datetime({'25-Feb-2016 13:20:44' '25-Aug-2016 13:20:44'},'TimeZone','UTC')
d =
25-Feb-2016 13:20:44 25-Aug-2016 13:20:44
>> d.TimeZone = 'America/New_York'
d =
25-Feb-2016 08:20:44 25-Aug-2016 09:20:44
  1 件のコメント
Saeed Bello
Saeed Bello 2016 年 8 月 26 日
Thank you Peter Perkins. Now I got it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by