how to create regular interval date with time stamp?
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
mukesh meharda
am 31 Jul. 2020
Beantwortet: Star Strider
am 31 Jul. 2020
I want to create a 15min time stamp with from date 14th Aug 2019 time 0:00 AM to 8th june 2020 time 23:45 PM and format should be like this
8/14/2019 12:00:00 AM
8/14/2019 12:15:00 AM
8/14/2019 01:00:00 AM
...........
...........
..........
..........
t/ill
6/8/2020 23:45:00 PM
0 Kommentare
Akzeptierte Antwort
Star Strider
am 31 Jul. 2020
Try this:
Timestamp = datetime([2019 08 14 0 0 0]) : minutes(15) : datetime([2020 06 08 23 45 00]);
Timestamp.Format = 'M/d/yyyy H:mm:ss a'; % Set Format
Timestamp = Timestamp.'; % Transpose To Column
Sample = [Timestamp(1:5); Timestamp(end-4:end)] % View Result (Delete)
producing:
Sample =
10×1 datetime array
8/14/2019 00:00:00 AM
8/14/2019 00:15:00 AM
8/14/2019 00:30:00 AM
8/14/2019 00:45:00 AM
8/14/2019 01:00:00 AM
6/8/2020 22:45:00 PM
6/8/2020 23:00:00 PM
6/8/2020 23:15:00 PM
6/8/2020 23:30:00 PM
6/8/2020 23:45:00 PM
The formats you want are not compatible.
You can have this format:
Timestamp.Format = 'M/d/yyyy H:mm:ss a'; % Set Format
or this format:
Timestamp.Format = 'M/d/yyyy h:mm:ss a'; % Set Format
(note the ‘H’ or ‘h’ differences), but not both.
.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!