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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:51:25+00:00 2026-05-23T09:51:25+00:00

i am using datepicker to insert date on my form, which of course returns

  • 0

i am using datepicker to insert date on my form, which of course returns date to the controller as a string.
the issue is when I try to convert this string to date, I get an error “invalid date”

Date.parse(params[:abc][:date])

To verify if I’m doing it right, I wrote the following ruby program:

string_date = "06/18/2011"
date = Date.parse(string_date)
puts date

This works perfectly fine. But when I try the same thing in my rails controller, it gives invalid date error.

please help.

  • 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-23T09:51:25+00:00Added an answer on May 23, 2026 at 9:51 am

    When I do this in my Rails 3.1 console:

    date = Date.parse("06/18/2011")
    

    I get an “ArgumentError: invalid date” exception. However, it works fine with an ISO-8601 date:

    date = Date.parse('2011-06-18')
    

    So perhaps you’re having a locale problem. Your script could be using your standard locale setting (which is probably some US locale judging by the date format) but your server is probably using something else.

    Try changing the jQuery datepicker date format to something standard and unambiguous by adding this:

    dateFormat: 'yy-mm-dd'
    

    to the datepicker’s options. The datepicker’s default is 'mm/dd/yy' and Ruby’s Date class doesn’t like seem to like it without a special locale setting.

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

Sidebar

Related Questions

I am using the datepicker which renders incorrectly on my webpage. The date rows
I am using the vanilla datepicker in Silverlight 2. I bind the selected date
I'm using the jQuery datepicker where I have two textboxes (start date / end
I am using the datepicker control from jQuery-ui 1.8. from-date is a text input.
I'm using ui.datepicker.js and I want to validate the date field to make sure
I'm using datepicker.iso8601Week() to calculate the week from a selected date (in a jQuery
I'm using jQuery DatePicker and it shows wrong date for November, 2009. You can
in my project I'm using this datepicker, I read how to put it into
Im using a JQuery Datepicker (datetimepicker actually) and would like the date (and time)
Basically I'm using datepicker from jQuery to have my client pick a date. I

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.