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)
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
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