Separate date and time

25 visualizaciones (últimos 30 días)
MatLab Code N
MatLab Code N el 21 de Sept. de 2021
Comentada: MatLab Code N el 22 de Sept. de 2021
I have the datetime in a column as given in an attached example excel sheet. Between date and time there is an alphabet T. Can I get a help to seperate out date and time.
Thanks!

Respuestas (1)

Steven Lord
Steven Lord el 21 de Sept. de 2021
dt = datetime('now') % Sample data
dt = datetime
21-Sep-2021 19:44:52
theTime = timeofday(dt)
theTime = duration
19:44:52
theDate = dt - theTime % or
theDate = datetime
21-Sep-2021
theDate2 = dateshift(dt, 'start', 'day')
theDate2 = datetime
21-Sep-2021
  2 comentarios
MatLab Code N
MatLab Code N el 21 de Sept. de 2021
I have also attached the example datetime along with the question. How can I make this work for my data?
MatLab Code N
MatLab Code N el 22 de Sept. de 2021
@Steven Lord any help is highly appreciated sir!

Iniciar sesión para comentar.

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by