Is this a bug, and if so a known bug? Looks like this question.
times = c('2020-03-28 00:00:00', '2020-03-29 00:00:00', '2020-03-30 00:00:00')
d_utc = as.POSIXct(times, tz='UTC')
d_eur = as.POSIXct(times, tz='Europe/London')
d_nul = as.POSIXct(times)
table(as.Date(d_utc))
#>
#> 2020-03-28 2020-03-29 2020-03-30
#> 1 1 1
table(as.Date(d_eur))
#>
#> 2020-03-28 2020-03-29
#> 1 2
table(as.Date(d_nul))
#>
#> 2020-03-28 2020-03-29
#> 1 2
The tz
argument's documentation in ?as.POSIXct
states: time zone specification to be used for the conversion, if one is required. System-specific (see time zones), but "" is the current time zone, and "GMT" is UTC (Universal Time, Coordinated). Invalid values are most commonly treated as UTC, on some platforms with a warning.
Looks like default UTC interpretation is not happening.
My environment:
> R.version
_
platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 0.0
year 2020
month 04
day 24
svn rev 78286
language R
version.string R version 4.0.0 (2020-04-24)
nickname Arbor Day