I want to convert "2013-09-16" into unix time.
I found Convert UNIX epoch to Date object in R but I need to do the reverse of that.
Thanks!
Method 1: Using lubridate package as_datetime() method in this package is used to convert UNIX Timestamp to Date Object. This method used the UTC timezone by default.
We can convert the character to timestamp by using strptime() method. strptime() function in R Language is used to parse the given representation of date and time with the given template.
You can use the as. Date( ) function to convert character data to dates. The format is as. Date(x, "format"), where x is the character data and format gives the appropriate format.
Quite simple:
as.numeric(as.POSIXct("2013-09-16 2:13:46 EST"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With