Convert Datetime to UTC
62 ビュー (過去 30 日間)
古いコメントを表示
How to convert datetime('today') into utc format. Preferably [YYYY MM DD 12 0 0].
0 件のコメント
採用された回答
Star Strider
2020 年 6 月 24 日
Try this:
T = datetime('now', 'Format','yyyy MM dd HH mm ss', 'TimeZone','local') % Local Time Zone
T.TimeZone = 'Z' % Convert To UTC
producing:
T =
datetime
2020 06 23 18 19 09
T =
datetime
2020 06 24 00 19 09
.
3 件のコメント
Star Strider
2020 年 6 月 24 日
My pleasure!
I thought that was just a formatting example.
I’m still not certain what you want.
Try this:
T = datetime('now', 'Format','yyyy MM dd 12 0 0', 'TimeZone','local') % Local Time Zone
T.TimeZone = 'Z' % Convert To UTC
Walter Roberson
2020 年 6 月 24 日
dateshift to start of hour or day.
If you need "noon" then dateshift to start of day and then add hours(12)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!