2

I have a date string in this format

20151201T011654

I am trying to use the function datenum like this but I get an error:

formatOut = 'yyyymmTHHMMss';
Time = datenum(TimeStr,formatOut)

I suspect my formatOut is wrong?

0

1 Answer 1

4

First you forgot the days dd and second the T can't be handled, get rid of it:

TimeStr = '20151201T011654'
formatOut = 'yyyymmddHHMMss';
Time = datenum(strrep(TimeStr,'T',''),formatOut)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.