Calculate delta time in seconds
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dion Theunissen
am 28 Okt. 2021
Beantwortet: Walter Roberson
am 28 Okt. 2021
i have a table where column 1 is the starttime and column 2 the stoptime. Now i want to insert in column 3 the delta time.
DataBaseA.Starttime = ["28-Jun-2021 05:05:38"]
DataBaseA.Stoptime = ["28-Jun-2021 05:15:38"]
Where each row has different datetimes.
Need a result like
DataBaseA.Deltatime = ["600"]
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Okt. 2021
SaT = datetime(DataaBaseA.Starttime, 'InputFormat', 'dd-MMM-yyyy HH:mm:ss');
StT = datetime(DataaBaseA.Stoptime, 'InputFormat', 'dd-MMM-yyyy HH:mm:ss');
dt = StT - Sat;
DataBaseA.Deltatime = string( seconds(dt) );
0 Kommentare
Weitere Antworten (1)
Jan
am 28 Okt. 2021
Starttime = "28-Jun-2021 05:05:38";
Stoptime = "28-Jun-2021 05:15:38";
Deltatime = compose("%d", seconds(datetime(Stoptime) - datetime(Starttime)))
0 Kommentare
Siehe auch
Kategorien
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!