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 7563851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:46:11+00:00 2026-05-30T13:46:11+00:00

With Ruby 1.8.7: >> require ‘time’ >> Time.parse ’01/28/2012′ => Sat Jan 28 00:00:00

  • 0

With Ruby 1.8.7:

>> require 'time'
>> Time.parse '01/28/2012'
=> Sat Jan 28 00:00:00 +0200 2012
>> Time.parse '28/01/2012'
=> ArgumentError: argument out of range

With Ruby 1.9.3:

>> require 'time'
>> Time.parse '28/01/2012'
=> 2012-01-28 00:00:00 +0200
>> Time.parse '01/28/2012'
=> ArgumentError: argument out of range

It looks like in Ruby 1.8.7 it was accepting US format (month/day/year), while in Ruby 1.9.3 it accepts only non US format (day/month/year).

Is there a way to change this behavior to be like Ruby 1.8.7?

  • 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-30T13:46:12+00:00Added an answer on May 30, 2026 at 1:46 pm

    Would it be an option for you to use Time.strptime("01/28/2012", "%m/%d/%Y") in place of Time.parse? That way you have better control over how Ruby is going to parse the date.

    If not there are gems: (e.g. ruby-american_date) to make the Ruby 1.9 Time.parse behave like Ruby 1.8.7, but only use it if it’s absolutely necessary.

    1.9.3-p0 :002 > Time.parse '01/28/2012'
    ArgumentError: argument out of range
    
    1.9.3-p0 :003 > require 'american_date'
    1.9.3-p0 :004 > Time.parse '01/28/2012'
     => 2012-01-28 00:00:00 +0000 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see this all the time in Ruby: require File.dirname(__FILE__) + /../../config/environment What does
I'm trying to use time.ago using standalone ActiveSupport, required thus: ruby require 'active_support/core_ext/date_time/calculations' If
Let's go to the code directly: #!/usr/bin/ruby require 'tk' class Epg def initialize @var
Is there a version of require in ruby that either loads the whole file,
In ruby, if I do require foo, is there a way to subsequently determine
In ruby, if you use mechanize following 301/302 redirects like this require 'mechanize' m
I understand the subtle differences between require , load and autoload in Ruby, but
I want to change the logging level of an application (ruby). require 'logger' config
As title. ruby test/functionals/whatevertest.rb doesn't work, that requires me to replace all require 'test_helper'
> gem env gempath /Users/davec/.gem/ruby/1.8:/opt/local/lib/ruby/gems/1.8 > head Rakefile require 'rubygems' puts Gem.path require 'rake/clean'

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.