Accurately converting from character->POSIXct->character with sub millisecond datetimes
I have a character datetime column in a file. I load the file (into a data.table ) and do things that require the column to be converted to POSIXct . I then need to write the POSIXct value back to file, but the datetime will not be the same (because it is printed incorrectly). This print/formatting issue is well known and has been discussed several times. I've read some posts describing this issue. The most authoritative answers I found are given in response to this question . The answers to that question provide two functions ( myformat.POSIXct and form ) that are supposed to solve this issue