Lubridate 没有在 R 中正确地将日期时间转换为 POSIXct (dd/mm/yy hh:mm:ss)

Lubridate not converting datetime to POSIXct correctly in R (dd/mm/yy hh:mm:ss)

我正在尝试将我的日期时间从 csv 转换为 POSIXct 以进行数据分析。我尝试了多个代码,但要么得到 NA,要么格式错误。

我目前使用的代码是

GRS$datetimelocal<- 
 GRS$`datetime` %>%
 ymd_hms(tz="UTC") %>% # first convert the `Date and Time (UTC)` 
 column into a 'POSIX' format 
 with_tz(tzone="Australia/Brisbane") # convert to local 
"Australia/Brisbane" date time (UTC + 10hrs)

我的日期时间列的格式是 dd/mm/yy hh:mm:ss。

datetime
26/03/2013 21:50
26/03/2013 21:56
26/03/2013 21:58
28/03/2013 07:42

然而,新列显示为

datetimelocal 
2026-03-20 13:21:50
2026-03-20 13:21:56
2026-03-20 13:21:58
2028-03-20 13:07:42

如有任何帮助,我们将不胜感激

为什么不直接使用as.POSIXct

as.POSIXct("26/03/2013 21:50", 
           format = "%d/%m/%Y %H:%M", 
           tz = "Australia/Brisbane")
## [1] "2013-03-26 21:50:00 AEST"