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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:10:28+00:00 2026-06-11T20:10:28+00:00

I have a date column in one of my models create_table jobs, :force =>

  • 0

I have a date column in one of my models

  create_table "jobs", :force => true do |t|
    t.date     "due_date"
  end

When I create a Job and then try to edit it, the date is not formatted the way I’d like in the form. What I want to see is “27 Sep 2012”. What I actually see is:

enter image description here

I found this question which implies that I can change the default date formats in an initializer. In config/initializers/date_time_formats.rb I have:

Date::DATE_FORMATS[:default] = "%d %B %Y"
Date::DATE_FORMATS[:db] = "%d %B %Y"

When I run the rails console and inspect the Date::DATE_FORMATS hash I see this (which looks correct):

{:short=>"%e %b", :long=>"%B %e, %Y", :db=>"%d %B %Y", :number=>"%Y%m%d", :long_ordinal=>#<Proc:0x007fce4509f9c8@/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.7/lib/active_support/core_ext/date/conversions.rb:12 (lambda)>, :rfc822=>"%e %b %Y", :default=>"%d %B %Y"}

I have restarted my server since making the initializer.

What am I doing wrong? I’m using Rails 3.2.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-06-11T20:10:29+00:00Added an answer on June 11, 2026 at 8:10 pm

    Only way I can seem to get this working is by faking a form_for input format and changing the default date format.

    # config/initializers/date_time_format.rb
    Date::DATE_FORMATS[:default] = "%d %B %Y"
    
    # jobs/edit.html.erb
    <%= form_for @job do |f| %>
      <%= text_field_tag 'job[due_date]', f.object.due_date %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have model with following field. date = models.DateTimeField(auto_now_add=True) When querying such model i`d
I have 3 Models. Each one has a column that holds a DateTime called
I have a table which will have a date/time column to store create date
I have table with one of the columns as date in 'YYYY-MM-DD' format. Can
I have a DATE column that I want to round to the next-lower 10
I have a date column where the date is displayed in the format 2009-11-18
I have a date column in a data frame in chr format as follows:
ISQL Perform Screen: I have a date column (format=mmm-dd-yyyy) used for storing Date Manufactured.
I have an Oracle DATE column with, for example, these values: RUN_DATE ------------------- 2012-06-09
I have a DATE datatype mysql column in a table. I want to set

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.