Create a monthly datetime sequence
显示 更早的评论
Hello everyone,
Can someone please me explain why this code
a=datetime(1981,1,1);
b=datetime(2019,31,1);
t1=a:calmonths(1):b;
t2=datetime(t1,'Format','yyyy-M-d');
M=datevec(t2);
Gives me monthly dates until july 2021? Am I missing something?
Thank you!
1 个评论
t1.Format = 'yyyy-M-d' % the correct way to set the format.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!