0

I have a vector or POSIXct and when I do as.character() on it, it returns numbers instead of the characters. I unfortunately cannot reproduce this with toy data but this is what is happening:

d = as.POSIXct(c( "2015-09-08 17:42:07.456 GMT","2015-09-08 17:42:19.778 GMT"))
class(d) ##this returns POSIXct

but as.character(d) returns

"1441740168.0001", "1441740168.0001"

Why am I getting "1441740168.0001", "1441740168.0001" instead of dates in character format?

blep
  • 726
  • 1
  • 11
  • 28
user3022875
  • 8,598
  • 26
  • 103
  • 167
  • It works for me. `class(d) [1] "POSIXct" "POSIXt"; as.character(d) [1] "2015-09-08 17:42:07" "2015-09-08 17:42:19"` – Pierre L Sep 10 '15 at 20:12

1 Answers1

0

Internally it represents dates as seconds passed since origin moment in time. Consult this for details.

user3274289
  • 2,426
  • 3
  • 16
  • 14