How to convert a Unix timestamp to POSIXct in R (i.e. 1532289300 = 2018-07-22 19:55:00)

If you are converting a column of Unix timestamps in a dataframe:

> df$Your.Times <- as.POSIXct(df$Your.Times, origin = “1970-1-1”)
[1] [POSIXct datetimes]

… or …

If you are converting a single Unix timestamp:

> yourtime = as.POSIXct(1532289300, origin = “1970-1-1”)
[1] 2018-07-22 19:55:00

Note: These solutions require the lubridate package.

Explanation:

In brief, as understood by Unix, time started on January 1, 1970 (the epoch date). The epoch date is represented as “0” Coordinated Universal Time (“UTC”) in Unix systems and all datetimes after the epoch date are represented as the number of seconds that have passed since the epoch date. Therefore, a Unix timestamp is the number of seconds since January 1, 1970 … approximately … leap seconds are not counted. as.POSIXct works be converting the number of seconds since January 1, 1970 into a readable datetime.

 
1
Kudos
 
1
Kudos

Now read this

How to display the IPv6 Neighbor Discovery Table in Windows

To display the Neighbor Discovery Table (ND Table) in Windows enter the following into the command prompt: > netsh interface ipv6 show neighbors On your local machine, windows maps IPv6 addresses to physical addresses (MAC addresses)... Continue →