Convert a date object into unix timestamp in R?

Viewed 125

Usually we see people converting into date objects - is it possible to do the reverse instead?

For example, given the following date

12-02-2019 00:00:00

convert this into unix time achieving the following value:

1549929600

Is this possible within ? Potentially there could be something in or but I have not figured it out yet. Thanks for the help.

1 Answers

Found the answer as simply:

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