create timeseries from first january to 31. December

1 次查看(过去 30 天)
Hi ,
I am trying to create a vector of timeseries with only months and days. No Year! I tried a few funktions but it requires to have a year. Somehow it is difficult to not include the year.
I appreciate any help.
  1 个评论
dpb
dpb 2018-8-14
That's so at present, yes. Closest so far is duration class that can be such, but even it requires a year to handle calendar durations owig to leap years messing things up.
You can set the display format to not show years and pretend they're not there visually but unfortunately all coding has to include them to get comparisons, etc., to work.

请先登录,再进行评论。

回答(1 个)

Steven Lord
Steven Lord 2018-8-15
I don't believe that's possible. How many days long is the vector from January 1st to December 31st? That's a simple question, right?
The answer to that simple question depends on whether the year containing those two dates is a leap year, a non-leap year, 1712 in Sweden, or perhaps 1753 in Sweden. [I'm not really sure off the top of my head how datetime handles those last two scenarios.]

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by