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

조회 수: 10(최근 30일)
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)
Whats the code for the extraction or conversion? Thank you so much...

채택된 답변

dpb 2021년 12월 3일
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
dpb 2021년 12월 3일
편집: dpb 2021년 12월 3일
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.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by