First, the reproducable example, showing how converting from character to 
POSIXct to character changes the milliseconds in the first time stamp 
though not in the second:

> as.POSIXct('2010-06-03 9:03:58.324')
[1] "2010-06-03 09:03:58.323 PDT"

> as.POSIXct('2010-06-03 9:03:58.325')
[1] "2010-06-03 09:03:58.325 PDT"

This seems to be due to truncation of the numeric value of the POSIX 
object during conversion to character:

> as.numeric(as.POSIXct('2010-06-03 9:03:58.324'))
[1] 1275581038.3239998817

Neither format() nor round() seem to be of assistance here.  Anyone got a 
solution?

> as.POSIXct(round(as.double(as.POSIXct('2010-06-03 09:03:58.324')), 
digits=3), origin=(as.POSIXct('1970-01-01')))
[1] "2010-06-03 17:03:58.323 PDT"
> format(as.POSIXct('2010-06-03 09:03:58.324'), "%Y-%m-%d %H:%M:%OS4")
[1] "2010-06-03 09:03:58.3239"

Thanks,
cur
-- 
Curt Seeliger, Data Ranger
Raytheon Information Services - Contractor to ORD
seeliger.c...@epa.gov
541/754-4638

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to