I want to convert "2013-09-16" into unix time.
我想将“2013-09-16”转换为unix时间。
I found Convert UNIX epoch to Date object in R but I need to do the reverse of that.
我在R中找到了转换UNIX纪元到Date对象,但我需要做相反的事情。
Thanks!
谢谢!
2 个解决方案
#1
42
Quite simple:
非常简单:
as.numeric(as.POSIXct("2013-09-16 2:13:46 EST"))
as.numeric(as.POSIXct(“2013-09-16 2:13:46 EST”))
#2
8
Simply cast to numeric:
简单地转换为数字:
as.numeric(as.POSIXct("2013-09-06", format="%Y-%m-%d"))
# [1] 1378418400
#1
42
Quite simple:
非常简单:
as.numeric(as.POSIXct("2013-09-16 2:13:46 EST"))
as.numeric(as.POSIXct(“2013-09-16 2:13:46 EST”))
#2
8
Simply cast to numeric:
简单地转换为数字:
as.numeric(as.POSIXct("2013-09-06", format="%Y-%m-%d"))
# [1] 1378418400