[R] POSIXct format

Christofer Bogaso bog@@o@chri@tofer @ending from gm@il@com
Tue Dec 4 13:51:03 CET 2018


I am trying to format my Character strings to POSIXct as below :

> as.POSIXct('2018-11-2700:00:00', format = "%Y-%m-%d%H:%M:%S", tz = 'UTC')
[1] "2018-11-27 UTC"
> as.POSIXct('2018-11-2701:00:00', format = "%Y-%m-%d%H:%M:%S", tz = 'UTC')
[1] "2018-11-27 01:00:00 UTC"

For the first case, I wanted to see "2018-11-27 00:00:00 UTC", but the
Hour/Min/Sec part was missing in R output. Is it possible to get consistent
formatting in both cases?

Thanks for your help. Regards

	[[alternative HTML version deleted]]

More information about the R-help mailing list