MATLAB Answers


Timestamp Formatting (Datenum Limitation?)

Asked by Kwen
on 19 Jun 2013

If I want a timestmap of the format string such that 'mm/dd/yy HH:MM:SS PM' is my format into matlab's numerical number,

datenum(01/01/13,'mm/dd/yy HH:MM:SS PM')

only displays the general number associated with the date and not the time. How do I correct this to get the full number with decimals indicating the time as well?




No products are associated with this question.

1 Answer

Answer by Andrei Bobrov
on 19 Jun 2013
Edited by Andrei Bobrov
on 19 Jun 2013

datenum('01/01/13 03:12:45 PM','mm/dd/yy HH:MM:SS PM');


datenum({'01/01/13 03:12:45 PM','01/02/13 06:12:45 AM'},'mm/dd/yy HH:MM:SS PM')


on 19 Jun 2013

Sorry that was a typo in my question, but not in my code. This runs for this specific date only, but errors on a vector.

For vector? See ADD in my answer.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!