将一年中的日期转换为日期 [英] Convert day of year to date

查看:84
本文介绍了将一年中的日期转换为日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将每年的日期转换为日期?例如,2004年第104天的日期是什么?

How do I convert day-of-year to date? For example, what's the date for 104th day of 2004?

这与您将POSIX日期转换为R中的年份?

推荐答案

我发现@TMS answer 会忽略原点中指定的年份,将其替换为执行命令的实际年份(如@Shekeine所示)。这样做似乎效果很好:

I found that @TMS answer ignores the year specified in the origin, replacing it with the actual year you are executing the command (as @Shekeine found). Doing this seems to work fine though:

as.Date(104, origin = "2014-01-01")

注意:在这种情况下,每年的日期为零!

CAUTION: day-of-year is zero based in this case!

这篇关于将一年中的日期转换为日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆