Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8439991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:09:38+00:00 2026-06-10T08:09:38+00:00

I am doing an experiment which produces automatically logged data. The software produces a

  • 0

I am doing an experiment which produces automatically logged data. The software produces a timestamp that is of the format 41149.014850. I would like to convert this decimal timestamp to 28.08.2012 00:21:23. How can I do this in R most elegantly?

I tried using the function strsplit and also the function as.Date with a specified origin, and also the times function. But to no avail. I have problems in splitting the timestamp into two numbers that I can access with the functions as.Date and times.

Here is some demo code:

myDatetime <- c(41149.004641, # 28.08.2012  00:06:41
41149.009745, # 28.08.2012  00:14:02
41149.014850, # 28.08.2012  00:21:23
41149.019954) # 28.08.2012  00:28:44

## not working out for me
Dat.char <- as.character(myDatetime)
date.split <- strsplit(Dat.char, split = "\\.")
## how to proceed from here, if it is a good way at all
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:09:39+00:00Added an answer on June 10, 2026 at 8:09 am

    You dates are in an Excel-like date format (days after January 1, 1900), so you need to convert them to an R date format. Then you can convert it to a datetime format (POSIXct).

    # first convert to R Date
    datetime <- as.Date(myDatetime-1, origin="1899-12-31")
    # now convert to POSIXct
    (posixct <- .POSIXct(unclass(datetime)*86400, tz="GMT"))
    # [1] "2012-08-28 00:06:40 GMT" "2012-08-28 00:14:01 GMT"
    # [3] "2012-08-28 00:21:23 GMT" "2012-08-28 00:28:44 GMT"
    # times are sometimes off by 1 second, add more digits to seconds to see why
    options(digits.secs=6)
    posixct
    # [1] "2012-08-28 00:06:40.9823 GMT" "2012-08-28 00:14:01.9680 GMT"
    # [3] "2012-08-28 00:21:23.0399 GMT" "2012-08-28 00:28:44.0256 GMT"
    # round to nearest second
    (posixct <- round(posixct, "sec"))
    # [1] "2012-08-28 00:06:41 GMT" "2012-08-28 00:14:02 GMT"
    # [3] "2012-08-28 00:21:23 GMT" "2012-08-28 00:28:44 GMT"
    # now you can convert to your desired format
    format(posixct, "%d.%m.%Y %H:%M:%S")
    # [1] "28.08.2012 00:06:41" "28.08.2012 00:14:02"
    # [3] "28.08.2012 00:21:23" "28.08.2012 00:28:44"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While doing some experiment on serialization, I noticed that my object name is lost
I am doing a data mining project in Python, and during the experiment phase
I am doing a simple coin flipping experiment for class that involves flipping a
I am interfacing with an external device which is sending data in hex format.
I'm doing a bit of an experiment in Python. I'm making a script which
I'm doing a kind of roundabout experiment thing where I'm pulling data from tables
I get this problem while doing some experiment with set . I use a
I was doing a little experiment with virtual destructors to review - wondering if
I'm doing a little experiment, trying to alternate background colours for nested divs. This
<disclaimer> What follows is the fruits of a thought experiment. What I'm doing isn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.