Change date format in vector

4 次查看(过去 30 天)
Hello i would like to uniform 2 different date format in a single vector:
4/1/2019 12:45:00 AM and 15/6/19 18:10
how can i do that?
  2 个评论
Davide Cerra
Davide Cerra 2020-8-20
The vector itself contains the 2 formats
Walter Roberson
Walter Roberson 2020-8-20
What is the data type being used? A vector of datetime only has one format associated with it.

请先登录,再进行评论。

采纳的回答

Binbin Qi
Binbin Qi 2020-8-20
t1 = datetime("4/1/2019 12:45:00 AM",'InputFormat',"dd/MM/yyyy HH:mm:ss a");
t2 = datetime("15/6/19 18:10",'InputFormat',"dd/MM/yy HH:mm");
t = [t1, t2]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by