How to Return a Time Object with Milliseconds in R Programming (Example Code)

In this article, I’ll illustrate how to parse milliseconds in the R programming language.

Example Data

time_data <- "2025-01-01 11:20:20.999"       # Create time character

Example: Printing Time with Milliseconds

options(digits.secs = 3)                     # Change global options
strptime(time_data, "%Y-%m-%d %H:%M:%OS")    # Print time with milliseconds
# "2025-01-01 11:20:20.999 CET"

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top