Clear Filters
Clear Filters

Format of datestr() changes

1 view (last 30 days)
Helma Maria Tróndheim
Helma Maria Tróndheim on 12 Oct 2017
Commented: Peter Perkins on 13 Oct 2017
Hi,
I'm was using datestr() to get the date string instead of number, when I realised that the format of the string changes. I've data over a year with a minute interval.
January-April, June-September and November show the date like this: dd.mm.yyyy HH:MM
while May, October and December show it like this: dd-mmm-yyyy HH:MM:SS
Why is that?
  6 Comments
Walter Roberson
Walter Roberson on 12 Oct 2017
Have you attempted doing the reading using readtable() and getting datetime objects instead of having to convert yourself ?
Peter Perkins
Peter Perkins on 13 Oct 2017
As Walter says, readtable is a much better choice for reading dates from an Excel file than xlsread.

Sign in to comment.

Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!