Forum: Ruby on Rails Date formatting and adding question

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Adam J. (Guest)
on 2006-03-18 19:45
Hey all,

I'm working on a site for a client that has a scedule im trying to
display that pulls the next events for the upcoming Sunday from a MySQL
table....The table stores the event date as mm/dd/yyyy. I've tried to
think of everyway possible to get this thing to change after every
sunday to show the next sunday's events, but I end up doing it

Is it possible to add to and find WHERE the date in the
database equals that....might sound confusing but i've seen this done in
ColdFusion easily like this:

SELECT * FROM Schedule
WHERE eventdate >=  #DateFormat(DateAdd("d", 7, Now()), "mm/dd/yy")#

Is it possible to do something like that in RoR?

Thanks in advance!
Michael Kaiser (Guest)
on 2006-03-18 20:31
(Received via mailing list)

I am not sure if I completely understand your question, but yes, you can
do arithmetics with dates. would be the beginning of the upcoming week, so would give you the next sunday. Once you
have your date you can use it as a condition in your find.

You can look it up here:

This topic is locked and can not be replied to.