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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:45:10+00:00 2026-05-18T00:45:10+00:00

I have a text field which is filled with a date from the jQuery

  • 0

I have a text field which is filled with a date from the jQuery UI Datepicker. Depending on the date format the user has selected in their profile on my site, datepicker will either fill in the text field with DD-MM-YYYY or MM-DD-YYYY. If the date is filled in as DD-MM-YYYY, Ruby on Rails interprets this correctly and the date is stored correctly. But when it’s MM-DD-YYYY, Ruby on Rails still thinks that it’s DD-MM-YYYY and so the date is stored incorrectly. How can I change the date format that Rails is expecting?

  • 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-18T00:45:11+00:00Added an answer on May 18, 2026 at 12:45 am

    You can use Date.strptime to use any format you want:

    >> RUBY_DESCRIPTION
    => "ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]"
    
    >> require 'date'
    => true
    
    >> Date.strptime('03/04/2010', '%d/%m/%Y').strftime('%c')
    => "Sat Apr  3 00:00:00 2010"
    
    >> Date.strptime('03/04/2010', '%m/%d/%Y').strftime('%c')
    => "Thu Mar  4 00:00:00 2010"
    

    So the first one is to take the 03 as day of month, while the second one is to take it as month.

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

Sidebar

Related Questions

I have a text field in which user can enter any character he/she wants.
I have a text field in SQLite database, which I want the user to
I have a form which has a search feature - a single text field
In a SQL server database, I have a table which contains a TEXT field
I have a type ahead text field, and when the user hits Enter I
Previously I have asked to strip text from a field and convert it to
I have two web forms which are filled in by the user. They contain
I have a text field (flash.display.textField) for editing, but the default font does not
If I have a text field with SWT, how can I get the field
I have a Tix.ComboBox with an editable text field. How do I force the

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.