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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:48:27+00:00 2026-06-14T03:48:27+00:00

I am trying to format my dates in the YYYY-MMM-DD manner. I have a

  • 0

I am trying to format my dates in the YYYY-MMM-DD manner. I have a en.yml file that has it specified.

formats:
  default: ! '%Y-%b-%d'

I have also created a date_time_formats.rb in my initializers folder.

Date::DATE_FORMATS[:default] = '%Y-%b-%d'
Time::DATE_FORMATS[:db]= '%Y-%b-%d'

I have also tried placing the same code directly in my environments.rb file. If I test out the defaults in the console Date.now.to_s then I get what I expect in return, “2012-Nov-10”, but in my view I always see “2012-11-10”.

I have tried saving it in the controller with Date.now and Date.now.to_s, but I still get the same result.

I must be missing something simple, so any help will be appreciated.

  • 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-14T03:48:28+00:00Added an answer on June 14, 2026 at 3:48 am

    I found the answer to my question, although I dont understand why. Here is a Stack answer that explains it here

    Basically I added these 2 lines of code to my environment.rb.

    Time::DATE_FORMATS.merge!({:db => '%m/%d/%Y', :uk_format => '%m/%d/%Y'})
    Date::DATE_FORMATS.merge!({:db => '%m/%d/%Y', :uk_format => '%m/%d/%Y'})
    

    And now everything works as planned. I looked for the documentation on the merge function to get a better understanding, but did not have any luck.

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

Sidebar

Related Questions

I have a file with dates in the format YYYY-mm . I am trying
I am trying to convert the format of the dates from yyyy-mm-dd to dd-mm-yyyy
I am trying to format some dates using the Java Date class. I have
I am trying to solve an interesting problem. I have a table that has,
I got a date time format - dd MMM yyyy , when trying to
I'm trying to insert date with MM/dd/yyyy Format into a date format field in
I am trying to insert date in table in format DD.MM.YYYY, How do I
I am trying to parse dates in RFC1123 format (Thu, 21 Jan 2010 17:47:00
I'm trying to parse dates with a given format and I've found this which
I am trying to output dates in the Italian format using date() as follows:

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.