Convert gregorian day to yyyy-mm

7 ビュー (過去 30 日間)
주희 박
주희 박 2022 年 7 月 12 日
コメント済み: 주희 박 2022 年 7 月 13 日
Hi, I attached 'Time' variable from 1995-01-01~2021-12-15 and it is monthly data.
It's units = 'days since 1950-01-01 00:00:00
I want to convert it yyyy-mm .
This is what i tried
  1. TT=datetime(1995,1,1)+hours(time); -> It starts 1996-11~
  2. TT=years(time) ->Absolutely wrong
  3. TT=datetime(time,'ConvertFrom','epochtime','Epoch','1950-01-01');->It's unit is seconds. Wrong
Please help me. Thanks.

採用された回答

Chunru
Chunru 2022 年 7 月 12 日
load Time.mat
%time
dt = datetime("1950-01-01 00:00:00") + days(time)
dt = 324×1 datetime array
15-Jan-1995 15-Feb-1995 15-Mar-1995 15-Apr-1995 15-May-1995 15-Jun-1995 15-Jul-1995 15-Aug-1995 15-Sep-1995 15-Oct-1995 15-Nov-1995 15-Dec-1995 15-Jan-1996 15-Feb-1996 15-Mar-1996 15-Apr-1996 15-May-1996 15-Jun-1996 15-Jul-1996 15-Aug-1996 15-Sep-1996 15-Oct-1996 15-Nov-1996 15-Dec-1996 15-Jan-1997 15-Feb-1997 15-Mar-1997 15-Apr-1997 15-May-1997 15-Jun-1997
  1 件のコメント
주희 박
주희 박 2022 年 7 月 13 日
Perfect. Thank you so much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics and Visualization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by