How to populate datetime object with one month´s dates for every minute?

So I want to populate a datetime vector in this way: 01-Jun-2016 00:00:00 01-Jun-2016 00:01:00 01-Jun-2016 00:02:00 . . . 30-Jun-2016 23:59:00
How do I do it?

 Accepted Answer

d = datetime(2016, 6, 1) : duration(0, 1, 0) : datetime(2016, 6, 30, 23, 59, 0);

3 Comments

FX's comment moved here from answer:
Thank you for your answer. However, this seems to make the correct amount of 'minutes' but I can´t see the actual timestamp in the cells populated. There are only the 1440 datetime for each minute in 24 hours but not the actual times.
So now I got 1440 of each day like this: 01-Jun-2016
Without the time component of that date.
Do you have further suggestions?
Also I would like to further edit the datetime vector to exclude certain periods from there. Ie. I want to delete a period of every Fri 5PM EST to Sun 5PM EST from the vector. Is there a 'datacutter' function or something like that, what would accomplish this task?
You can change the Format property of the datetime object to display it the way you want.
Possibly,
d.Format = 'dd-MMM-yyyy HH:mm:ss'

Sign in to comment.

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Tags

Asked:

FX
on 19 Jul 2016

Commented:

on 19 Jul 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!