[R] Change date time to epoch time

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sun Nov 17 04:21:24 CET 2013


There are many epochs. Which one are you interested in? If you are interested in the POSIX time_t epoch, then you could look at ?DateTimeClasses to find out about ?as.POSIXct. You might also find my email on inputting zones informative [1].

Also, per the Posting Guide, please don't post in html format... it messes up your R code.

[1] https://www.stat.math.ethz.ch/pipermail/r-help/2013-August/357939.html
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

vivek kumar singh <vksingh.iiitb at gmail.com> wrote:
>Hi All,
>
>I have time series data in (Year-month-date-hour-minute-second) format 
>and i want to convert it to epoch time.
>
>I have tried the following:
>*> Sys.time()**
>**[1] "2013-11-17 10:39:46 MYT"**
>**> as.numeric(Sys.time())**
>**[1] 1384656006**
>**> as.numeric("2013-11-17 10:39:46 MYT")**
>**[1] NA**
>**Warning message:**
>**NAs introduced by coercion **
>**> as.numeric("2013-11-17 10:39:46 MYT")**
>**[1] NA**
>**Warning message:**
>**NAs introduced by coercion **
>*
>Please let me know which function in R converts date-time to epoch
>time.
>
>Regards,
>Vivek
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list