Rails has time extensions, so you can use things like
Time.now.next_month and Time.now.next_month.month
Go into your script/console and check it out. It''s pretty sweet for
doing Time and Date-based work.
Also see api.rubyonrails.org under CoreExtensions::Numeric::Time
In my experience, the Date class sucks and I don''t use it.
Jason
Sam Woodard wrote:> How do I format this so that it does what I want it to,
>
> Day.find_by_month_and_year(
> [Date::today.month + 1 if !Date::today.month == 12 else 1 end],
> [Date::today.year if !Date::today.month == 12 else Date::today.year +
> 1 end]
> )
>
> ?
>
> WHICH IS
>
> to pass Day.find_by_month_and_year Date:today.month +1 if the month is
> not december otherwise pass, 1, and to pass as the second argument
> Date::today.year unless it IS the december, then I want it to pass it 1.
>
> Thanks?
> Sam
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---