I want to round a POSIXct down to the day, relative to a specific timezone.
If I try
round(as.POSIXct("2013-03-05 23:00:00 EST"), "day")
It returns
2013-03-06
Which makes sense, in that when it's 23:00:00 EST on 2013-03-05 in EST5EDT, it's already 2013-03-06 in UTC. Logically, what I want to do is:
round(as.POSIXct("2013-03-05 23:00:00 EST"), "day", tz="EST5EDT")
That is, "round this date and time to the nearest day, relative to the EST5EDT time zone". Unfortunately, round doesn't take a time zone parameter.
See Question&Answers more detail:os