datetime without leading zero
16 views (last 30 days)
Show older comments
datetime('212704','InputFormat','Hmmss')
gives an error.
datetime('21:27:04','InputFormat','H:mm:ss')
does not.
This is a problem when importing time noted as hours without leading zero as in the first format using textscan. Using:
datetime('92704','InputFormat','HHmmss')
gives an error due to the lack of the leading zero. Any workaround for this?
0 Comments
Answers (2)
the cyclist
on 25 Nov 2017
Edited: the cyclist
on 25 Nov 2017
Can you sneak a formatting step between the import and the date function?
sprintf('%06.0f',92704)
ans =
'092704'
and
sprintf('%06.0f',212704)
ans =
'212704'
and then use the 2-digit hour format?
See Also
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!