简体   繁体   中英

Strange behavior with as.character

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM