简体   繁体   English

在R中,如何以yyyymmdd格式输出rubridate兼容日期? 在.NET中相当于.ToString(“yyyyMMdd”)?

[英]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.

相关问题 如果我的传入日期格式为YYYYMMDD,则将字符串转换为.NET中的日期 - Convert String to Date in .NET if my incoming date format is in YYYYMMDD YYYYMMDD日期格式化正则表达式以验证C#.net中的日期 - YYYYMMDD Date Format regular Expression to validate a date in C# .net 如何解析具有非标准格式 (yyyyMMdd:Hmm) 的日期时间? - How can I parse a datetime with a nonstandard format (yyyyMMdd:Hmm)? 如何将“ yyyyMMdd Hmm”格式的字符串解析为DateTime? - How to parse a string to DateTime with “yyyyMMdd Hmm” format? 如何将日期从yyyyMMdd格式转换为mm-dd-yyyy格式 - How to convert date from yyyyMMdd format to mm-dd-yyyy format 无法使用DateTime.TryParseExact()以yyyyMMdd Hmm格式解析日期 - Failing to parse date in yyyyMMdd Hmm format using DateTime.TryParseExact() 通过指定区域性名称设置日期格式yyyyMMdd - Setting Date format yyyyMMdd through specify Culture Name 根据YYYYMMDD等格式化.NET DateTime的最简单方法是什么? - What's the simplest way to format a .NET DateTime according to YYYYMMDD or the like? 使用 JSON.net 序列化 yyyyMMdd 格式的不带引号的日期 - Use JSON.net to serialize yyyyMMdd formatted date without quotes 设置DateTimePicker控件以格式化YYYYMMDD? - Set DateTimePicker Control to format YYYYMMDD?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM