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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:02:10+00:00 2026-06-09T20:02:10+00:00

I am trying to format my date from my RoR project, though having real

  • 0

I am trying to format my date from my RoR project, though having real issue understanding how this works. In php this is a simple date(“format”,time())

if i call just the standard time stored within the database i am getting
2012-08-12 22:25:00 +1000

I am trying to call the date formats event_time and event_date

Time::DATE_FORMATS[:month_and_year] = "%B %Y"
Time::DATE_FORMATS[:event_time] = "%l:%M %p"
Time::DATE_FORMATS[:event_date] = "%a, %e %b, %Y"

I am currently trying to call this like

= schedule.time.to_s(:event_time)

The issue I am having is that I am getting the following error:

wrong number of arguments(1 for 0)

  • 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-09T20:02:11+00:00Added an answer on June 9, 2026 at 8:02 pm

    You can use strftime or esle your approach is also good if you need data frequently in this date format

    The code you added works great for me

    pritesh@cloudy-pritesh:~/railsdemo$ rails c
    Loading development environment (Rails 3.2.6)
    1.9.3p194 :001 > Date.today.to_s(:event_time)
     => "2012-08-13" 
    1.9.3p194 :002 > Time::DATE_FORMATS[:month_and_year] = "%B %Y"
     => "%B %Y" 
    1.9.3p194 :003 > Time::DATE_FORMATS[:event_time] = "%l:%M %p"
     => "%l:%M %p" 
    1.9.3p194 :004 > Time::DATE_FORMATS[:event_date] = "%a, %e %b, %Y"
     => "%a, %e %b, %Y" 
    1.9.3p194 :005 > Time.now.to_s(:event_time)
     => "11:13 AM" 
    

    you can also do this by using Time.now.strftime("%B %Y")

    My last guess, may be you are looping the records and shomewhere in the records there is a record with time having nil value

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

Sidebar

Related Questions

i'm trying to get date from UIDatePicker (MM-dd format) and to check if its
I'm trying to change the date format I get from my webservice to a
im trying to convert a date format into a new format in this example
I', trying to re-format a date from a table in Codeigniter. The Controller is
Im trying to order results ASCENDING from the current date this is what im
I'm trying to format a date from a RSS feed: Mon, 27 Feb 2012
Im trying to display my Date field from my MySQL database. format is 2012-01-01
I am trying to change the format of a date from one to another,
I am trying to convert the date format from dow mon dd hh:mm:ss zzz
I am trying to format a date from an RSS feed using the following

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.