简体   繁体   English

将日期对象转换为 R 中的 unix 时间戳?

[英]Convert a date object into unix timestamp in R?

Usually we see people converting into date objects - is it possible to do the reverse instead?通常我们会看到人们将转换为 date 对象 - 是否可以反过来做?

For example, given the following date例如,给定以下日期

12-02-2019 00:00:00

convert this into unix time achieving the following value:将其转换为 Unix 时间,实现以下值:

1549929600

Is this possible within ?这在可能吗? Potentially there could be something in or but I have not figured it out yet. 可能有一些东西,但我还没有弄清楚。 Thanks for the help.谢谢您的帮助。

找到答案很简单:

as.numeric(as.POSIXct("12-02-2019 00:00:00 EST")) 

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

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