date - convert from posix timestamp in %Y-%m-%d in R -


I have the date in this format:

  1397758632   

and I need to convert these formats into these dates% Y-% m-% d How can I do this? My timezone is GTM. Using the .POSIXct () function:

  as.POSIXct (x = "1397758632", original = "1960-01-01", tz = "GMT ")   

I have this error

  as error. POSIXlt.character (x, tz, ...): Character string is not in standard denial format   

How do I get a readable data?

Some things if you defined a variable x = "1397758632" You do not need to declare it again, just use x for example, // as.POSIXct (x, origin = "1970-01-01" , tz = "GMT")

2, x = "1397758632" / code> is actually a variable variable, try str (x) You want to declare it numerically, x = 1397758632 and you're all good.

Finally, to add as.Date () if you just want a date and do not stamp full time.

Then something like this:
x = 1397758632 POSIXct (x, origin = "1970-01-01", tz = "GMT") as.Date (as.POSIXct (x, origin = "1970-01-01", tz = "GMT")) #date only

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -