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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:39:17+00:00 2026-06-18T04:39:17+00:00

Is it possible to create a column or to change one to type date

  • 0

Is it possible to create a column or to change one to type date with default format?
something like:

def change
    change_column :mytable, :mydate, :date [:default]="%d/%m/%Y"
end
  • 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-18T04:39:18+00:00Added an answer on June 18, 2026 at 4:39 am

    To my knowledge no. But why on Earth would you want to do that?

    Rails will pull out a date and automagically make it a Date/Time (according to your column type) object. If you need to display your date differently I strongly suggest the use of strftime like so:

    @foo.created_at.strftime('%F')
    

    Here’s a list of the different options: http://www.ruby-doc.org/core-1.9.3/Time.html#method-i-strftime

    Update

    Make use of decorators with Draper: https://github.com/drapergem/draper

    I would recommend renaming the method but for now if you don’t want to you could simply override it doing this:

    # app/decorators/article_decorator.rb
    class ArticleDecorator < Draper::Decorator
      delegate_all
    
      def published_at
        source.published_at.strftime("%A, %B %e")
      end
    end
    

    You would it like so:

    @article.decorate.published_at
    

    In it’s default state, the date returned will not be formatted which is fine.

    If you have to do where("date.strftime('%d/%m/%Y') >= ?",fdate, you’re doing it wrong. Again, stick to the default format.

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

Sidebar

Related Questions

Is it possible to create a table having column but column without datatype? Meaning
Other than using the Column chart and naming appropriately is it possible to create
Is it possible to create an index that has as one of its columns
Hi it'd like to know if it's at all possible create a parametric equalizer
Possible Duplicate: Create event handler for OnScroll for web browser control I would like
Possible Duplicate: Create Excel file in Java How to save output in excel format
I have one GridView with 3 Column and 3 Rows I want to change
I have a column named Lastmodified , with a data type of Date ,
I created a table inside NetBeans but one column is wrong type, it should
Is possible create an extension for SQL Management Studio in Visual Studio 2010? Visual

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.