how to create regular interval date with time stamp?
27 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Star Strider
2020 年 7 月 31 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!