Combine date and duration into single datetime column
조회 수: 16 (최근 30일)
이전 댓글 표시
Hello!
I have a vector containing the data in a datetime format (MM/dd/uuuu)and the vector containing the hours of the days in duration format(hh:mm:ss)
I want to combine the two vectors in order to get a single datetime vector having date and hour togheter.
I tried this code but it seems that is not working:
new_datetime=date+hour;
댓글 수: 0
채택된 답변
Star Strider
2022년 2월 21일
Add them —
DT = datetime(repmat([2018 01 01], 5, 1))
DU = duration('00:00:00') + 5*minutes(0:4)'
Combined = DT + DU
.
댓글 수: 8
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!