how to create regular interval date with time stamp?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
mukesh meharda
le 31 Juil 2020
Réponse apportée : Star Strider
le 31 Juil 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 commentaires
Réponse acceptée
Star Strider
le 31 Juil 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets 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!