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

  • Home
  • SEARCH
  • 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 4063918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:47:18+00:00 2026-05-20T15:47:18+00:00

I am trying to parse a vector of time string and came across a

  • 0

I am trying to parse a vector of time string and came across a strange error. For example, if I run the following section of code, R returned the result as expected.

time_format="%m/%d/%Y %H:%M:%S"
t_1 = "03/13/2011 01:00:10"
as.POSIXct(t_1, format = time_format)

Output:

[1] "2011-03-13 01:00:10 EST"

However, if I change the time slightly to 2 AM

t_2 = "03/13/2011 02:00:10"
as.POSIXct(t_2, format = time_format)

The output became:

[1] NA

I can reproduce it on R 2.11.1 and 2.12.2 on Windows 7 and XP. Does anyone encounter the same problem?

Thanks,
Derek

  • 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-05-20T15:47:18+00:00Added an answer on May 20, 2026 at 3:47 pm

    You cannot parse non-existing times. 02:00:10 did not exist as we had ‘spring forward’ this Saturday night / Sunday morning with the switch to daylight-savings. R knows this:

    R> t_1 = "03/13/2011 01:00:10"; as.POSIXct(t_1, format = time_format)
    [1] "2011-03-13 01:00:10 CST"
    R> t_2 = "03/13/2011 02:00:10"; as.POSIXct(t_2, format = time_format)
    [1] "2011-03-13 01:00:10 CST"
    R> t_3 = "03/13/2011 03:00:10"; as.POSIXct(t_3, format = time_format)
    [1] "2011-03-13 03:00:10 CDT"
    R> 
    

    On Linux, my timezone library seems to cope — 02:00:10 becomes 01:00:10 as an hour is subtracted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML code that I'm trying to parse, but I'm sure
I'm trying to parse an international datetime string similar to: 24-okt-08 21:09:06 CEST So
I'm trying to parse a simple string in C++. I know the string contains
i am trying to make sense of the following result. The test case code
I'm trying to parse the title from the following webpage: http://kid37.blogger.de/stories/1670573/ When I use
I'm trying to parse a section of a large file with Java's Scanner library,
I have the following spirit grammar. I am trying to create a vector of
I trying to parse a string in an XML node by using an XPath
I'm trying to parse a string into smaller ones, extracting some values and then
I am trying to parse a string something like this: Input 20:00 - output

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.