How to create sequence datetime in matlab by specific duration
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Pradya Panyainkaew
il 24 Gen 2018
Commentato: Peter Perkins
il 24 Gen 2018
I want to create a set of date time in this format datetime
date=('01/12/2016 00:15:00','InputFormat','dd/MM/yyyy HH:mm:ss')
from
if true
t1 = datetime('01/12/2016 00:15:00','InputFormat','dd/MM/yyyy HH:mm:ss');
t2 = datetime('31/12/2016 23:45:00','InputFormat','dd/MM/yyyy HH:mm:ss');
end
How to create sequence datetime in matlab by specific 15 mins interval from t1 to t2 ?
1 Commento
Peter Perkins
il 24 Gen 2018
If those timestamp literals are actually supposed to represent text values that are read from a file or something, then those calls to datetime are probably fine. But ikf you have typed that, literally, in your code, you are likely better off using
datetime(2016,12,1,0,15,0)
datetime(2016,12,31,23,45,0)
You may find the text version easier to read, but noone reading the numeric version has to wonder if it's Dec 1st or Jan 12th.
Also, the numeric version often allows you to do things like
datetime(2016,12,1,0,15:15:1425,0)
although maybe in your case Fangjun's suggestion is simpler.
Risposta accettata
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!