Remove time from datetime
29 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
vidit kedia
il 21 Gen 2021
Commentato: vidit kedia
il 21 Gen 2021
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 Commenti
Risposta accettata
Steven Lord
il 21 Gen 2021
Modificato: Steven Lord
il 21 Gen 2021
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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dates and Time in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!