How to store partially known datetimes
Show older comments
What is the best way in MATLAB to deal with partially known date times?
I have a list of dates and times as part of a database. For most, I know the full date and time, but for many I only know down to the day, or month, or even just year. Currently, I have them stored in a table seperated by year, month, day, and time, but I would much prefer a single field if possible.
Is there a way to use the datetime or other datatype in MATLAB to convey that information about the date and time could be missing?
1 Comment
Walter Roberson
on 7 Oct 2020
Unfortunately, datetime objects only have specific complete datetimes, or else the Not A Time object, NaT .
You could fill out the datetime objects as far as you know, using the "start" of the date (e.g., Jan 1, 00:00:00 of the year), and also keep a numeric encoding of which information is missing (perhaps an enumeration)
Accepted Answer
More Answers (0)
Categories
Find more on Time Series Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!