Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (5.3k points)

I'm plotting and performing calculations on uniformly distributed time series. The timestamps are currently stored as integers representing the number of seconds since the UNIX epoch (e.g. 1352068320), but Date objects seem more appropriate for plotting. How can I do the conversion?

I've read ?Date, ?as.Date and ??epoch, but seem to have missed that information.

1 Answer

0 votes
by

To convert UNIX epoch to a Date object, you can use the anytime package as follows:

library("anytime")

anytime(1352068320)

[1] "2012-11-05 04:02:00 IST"

anydate(1352068320)

[1] "2012-11-05"

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...