Separating datetime data ('yyyy-MM-dd HHmm:ss' Into 'hh:mm:ss')

7 Ansichten (letzte 30 Tage)
Tyann Hardyn
Tyann Hardyn am 3 Dez. 2021
Bearbeitet: dpb am 3 Dez. 2021
Hi, Community ~
I have a simple question... I have a datetime data like this :
2017-12-31 23:34:00
2017-12-31 23:35:00
2017-12-31 23:36:00
2017-12-31 23:37:00
2017-12-31 23:38:00
2017-12-31 23:39:00
2017-12-31 23:40:00
2017-12-31 23:41:00
2017-12-31 23:42:00
2017-12-31 23:43:00
2017-12-31 23:44:00
2017-12-31 23:45:00
2017-12-31 23:46:00
2017-12-31 23:47:00
2017-12-31 23:48:00
2017-12-31 23:49:00
2017-12-31 23:50:00
I just want to know, how to convert it or extract the data to become duration only? (I want to get the duration Data only)
23:34:00
23:35:00
23:36:00
23:37:00
23:38:00
23:39:00
23:40:00
23:41:00
23:42:00
23:43:00
23:44:00
23:45:00
23:46:00
23:47:00
23:48:00
23:49:00
23:50:00
Whats the code for the extraction or conversion? Thank you so much...

Akzeptierte Antwort

dpb
dpb am 3 Dez. 2021
See
doc timeofday
NB: When you have an area of functionality but don't know the function name, the "Functions" link at the top of the documentation page for any function in the area for which you do know the name will provide an annotated list of all the related functions.
In this case, if you bring up the doc for datetime, you'll have that link at the top of the page and will find timeofday listed.
I notice the description for it isn't the best; I'll try to take the time to write a suggestion for upgrading the documentation; it has the function listed in area to return numeric values which could be improved to note it returns a duration.
It took me ages to figure this out in the new documentation myself; before there was the lookfor function at the command line or help for a toolbox or area of a given set of functionalities by the area of the MATLABPATH folder; that hasn't been kept up and owing to the massive growth of functionality it isn't nearly as useful as it once was -- but the "functions" list is invaluable tool.
  2 Kommentare
Tyann Hardyn
Tyann Hardyn am 3 Dez. 2021
GREAT, Thats kinda a new function, yes?? I said thank you so much ! You save my life
dpb
dpb am 3 Dez. 2021
Bearbeitet: dpb am 3 Dez. 2021
It seems like it, but was introduced at the same time as the datetime and duration classes were released in R2014b so it's getting to be a fair time since...
The documentation now includes an introduction date at the end of every function for everything since R2006b. There's much to be learned by exploring the documentation in greater depth than the most cursory glance at the top.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by