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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:08:20+00:00 2026-05-15T05:08:20+00:00

In my model, I have a departure_date and a return_date. I am using a

  • 0

In my model, I have a departure_date and a return_date.

I am using a text_field instead of the date_select so that I can use the JQuery datepicker.

My app is based in the US for now but I do hope to get international members.

So basically this is what is happening. The user (US) types in a date such as 04/01/2010 (April 1st).

Of course, MySQL stores it as a datetime such as 2010-04-01…

Anyway, when the user goes to edit the date later on, it shows “01/04/2010” because I am using a strftime(“%m/%d/%Y) which doesn’t make sense….so it thinks it is January 4th instead of the original April 1st.

It’s like the only way to accurately store the data is for the user to type in: 2010-04-01

I hope all of this makes sense. What I am really after is a way for the user to type in (or use the datepicker) a date in their native format.

So someone in Europe could type in 01/04/2010 for April 1st but someone in the US would type in 04/01/2010.

Is there an easy, elegant solution to this?

Thanks for any suggestions.

  • 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-15T05:08:20+00:00Added an answer on May 15, 2026 at 5:08 am

    I have been confronted to the same issue lately.

    My website is based in france, so i have to store date as a french date.

    I also use a Jquery DatePicker.

    To do this, i set the I18n.locale to the visitor’s country. For exemple :

    I18.locale = :fr
    

    You can do this with a before_filter into your application_controller

    Then, into your locales/fr.yml you can define the way you want to show the date

    And finally, into your view, you can set the date format view, with the JqueryDatePicket properties.

    If i remember well, this methode was something like that:

    $.datepicker.formatDate('dd-mm-yyyy');
    

    You can find it anyway on the datepicker documentation.

    And this format can be found for exemple into your locale/fr.yml

    And that’s all !

    Hope this will help !

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

Sidebar

Related Questions

for instance, I have 2 model Drummer and Video If I use one-to-many association
On a Content model have an attribute named slug . When creating a new
I have model Products with columns: name, number, description Index defined for this model
I have category model, in which I want to load some default data. How
I have model Person or say Profile and this class Person has a genericRelationship
I have model called Search and a resource named :search . I'd like to
I'm building a system which will have a few channels feeding different clients (MonoDroid,
As the complexity of the web projects that I am working on increases, the
I am currently struggling with a circular dependency problem when designing my classes. Ever
A common MVVM/WPF approach is to data-bind the UI's controls directly to the underlying

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.