MATLAB Answers

0

Transform into a Matlab datetime format

Asked by alpedhuez on 14 Jun 2018 at 15:08
Latest activity Commented on by alpedhuez on 14 Jun 2018 at 22:24

I have an entry "2017-10-26 06-PM" How can I transform this entry into a datetime format that Matlab can understand?

  0 Comments

Sign in to comment.

Tags

Products

1 Answer

Answer by Sean de Wolski
on 14 Jun 2018 at 15:22
Edited by Sean de Wolski
on 14 Jun 2018 at 15:25
 Accepted Answer

datetime("2017-10-26 06-PM",'InputFormat','yyyy-MM-dd hh-aa')

doc: https://www.mathworks.com/help/releases/R2018a/matlab/ref/datetime.html#d119e206701

  3 Comments

Thank you. I have a table A with the entries of the first column are of the format "2017-10-26 06-PM." How can I transform this first column into datetime format?

exactly the same way:

yourtable.columnname = datetime(yourtable.columname, 'InputFormat', 'yyyy-MM-dd hh-aa')

Great help.

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today