Combine date and duration into single datetime column
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Enrico Gambini
le 21 Fév 2022
Commenté : Star Strider
le 21 Fév 2022
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 commentaires
Réponse acceptée
Star Strider
le 21 Fév 2022
Add them —
DT = datetime(repmat([2018 01 01], 5, 1))
DU = duration('00:00:00') + 5*minutes(0:4)'
Combined = DT + DU
.
8 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Type Identification dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!