MazamaScience/MazamaCoreUtils

dateSequence() function

Closed this issue · 0 comments

Just ran into a situation where seq(start, end, unit = "day") created a sequence by adding 24 hours. Only problem is that this sequence started in January and ran until December and all of the PST day boundaries were at 00:00 while all of the PDT boundaries were at 01:00.

We need a dateSequence() function like dateRange() that calculates day boundaries in local "clock" time so that it is 00:00 in PST and 00:00 in PDT.

Yes, this will result in one 25 hour day and one 23 hour day but having day boundaries at midnight is useful.

Create this functionality by creating a mid-day sequence in the local timezone with unit = "day". Then daystamp <- strftime("%Y%m%d"). Then parseDatetime(daystamp).