lubritation的格式日期
我的输入数据格式为角色,看起来像是
"2020-07-10T00:00:00"
我尝试过的
library(lubridate)
mdy_hms("2020-07-10T00:00:00", format='%Y-%m-%dT%H:%M:%S', tz=Sys.timezone())
,但是我得到了
[1] Na Na 警告消息: 所有格式都无法解析。找不到格式。
我尝试了更多的flexibel方法parse_date_time()
,但是如果没有运气,
parse_date_time("2020-07-10T00:00:00", '%Y-%m-%dT%H:%M:%S', tz=Sys.timezone())
我该如何将此日期转换为“ 2020-07-10T00:00:00:00:00”:r识别的日期?注意:我真的对时间不感兴趣,只有日期!
My input data, formatted as character, looks like this
"2020-07-10T00:00:00"
I tried
library(lubridate)
mdy_hms("2020-07-10T00:00:00", format='%Y-%m-%dT%H:%M:%S', tz=Sys.timezone())
But I get
[1] NA NA
Warning message:
All formats failed to parse. No formats found.
I tried the more flexibel approach parse_date_time()
, but without luck
parse_date_time("2020-07-10T00:00:00", '%Y-%m-%dT%H:%M:%S', tz=Sys.timezone())
How can I convert this date "2020-07-10T00:00:00" to a date R recognizes? Note: I am not interested in the time really, only the date!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不只是
有趣的事实:
Why not just
Fun fact:
假设07是7月的月份,而第10个月是第10个月:
如果以年度为单位,则将YMD换成YDM。
希望这有帮助!
Assuming that the 07 is the month of July, and the 10 is the 10th:
If it's in format year-day-month, swap the ymd for ydm.
Hope this helps!