Remove time from datetime
조회 수: 42 (최근 30일)
이전 댓글 표시
I would like to remove the time from a datetime element, without using the .Format = 'dd-MMM-yyy', as this only chages the display format but the time component is still present in the element.
댓글 수: 0
채택된 답변
Steven Lord
2021년 1월 21일
편집: Steven Lord
2021년 1월 21일
Use timeofday to create a duration array containing the time since midnight for each of the datetime arrays.
rightNow = datetime('now')
timeSinceMidnight = timeofday(rightNow)
And since I'm guessing you may be trying to "split" the datetime:
todaysDate1 = dateshift(rightNow, 'start', 'day') % or
todaysDate2 = rightNow - timeSinceMidnight
추가 답변 (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!