[英]In R, how do I output a lubridate compatible date in yyyymmdd format? The equivalent of .ToString(“yyyyMMdd”) in .NET?
In R
, I can parse a date into Lubridate format using: 在
R
,我可以使用以下方法将日期解析为Lubridate格式:
d <- ymd("2013-02-15")
How do I output this in yyyyMMdd
format, eg: 如何以
yyyyMMdd
格式输出,例如:
20130215
The equivalent .NET command would be: 等效的.NET命令是:
.ToString("yyyyMMdd")
I know the answer to this will be simple, but I've spent the last hour attempting to find any reference to outputting dates with Lubridate with no success so far. 我知道答案很简单,但我花了最后一小时试图找到任何与Lubridate输出日期的参考,但到目前为止没有成功。
format(d, "%Y%m%d")
yields 产量
> format(d, "%Y%m%d")
[1] "20130215"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.