Error using datetime/datenum

22 views (last 30 days)
Selim Khan
Selim Khan on 13 Jan 2021
Commented: Selim Khan on 13 Jan 2021
Hello,
Could anyone help me finding the error in my datenum command as shown below and with the screenshot?
>> dataset.date=datenum(dataset.date,'yyyy-mm-dd');
Error using datetime/datenum; Too many input arguments.
Thanks in advance,
Selim

Answers (1)

Cris LaPierre
Cris LaPierre on 13 Jan 2021
First problem is you are trying to convert your datetime to a datenum. I hightly recommend keeping it a datetime. What are you trying to do that you want a datenum for?
Second, dataset.date is a datetime, not a string. You have too many input arguments because the formatIn input is only valid if your dates are strings. Remove this setting and your code should work.
  1 Comment
Selim Khan
Selim Khan on 13 Jan 2021
Hi Cris,
Thanks for your kind reponse. Yes, it worked without converting to datenum. Regards, Selim

Sign in to comment.

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!