简体   繁体   English

R中自日期至今的秒数

[英]seconds since date to date in R

I have a dataset file with a time variable in "seconds since 1981-01-01 00:00:00".我有一个数据集文件,其时间变量为“自 1981-01-01 00:00:00 以来的秒数”。 What I need is to convert this time into calendar date (YYYY-MM-DD HH:mm:ss).我需要的是将此时间转换为日历日期(YYYY-MM-DD HH:mm:ss)。 I've seen a lot of different ways to do this for time since epoch (1970) (timestamp, calendar.timegm, etc) but I'm failing to do this with a different reference date.自 epoch (1970)(时间戳、calendar.timegm 等)以来,我已经看到了很多不同的方法来执行此操作,但是我没有使用不同的参考日期来执行此操作。

One option is to simply add 347133600s (11 years) to each value in seconds.一种选择是以秒为单位简单地将 347133600s(11 年)添加到每个值。 this will then allow you to simply use conversion as it would be from 1970-01-01.这将允许您像 1970-01-01 一样简单地使用转换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM