Remove time from datetime
36 次查看(过去 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!