Page 1 of 1

help with day today and yesterday

Posted: Tue Feb 07, 2012 7:48 pm
by pleigh
hi community,

i have this problem and could not formulate a logic regarding dates/days. the scenarion is:

i have a search feature on my site and a filter for dates. in the dropdown, i have items from Monday to Sunday. if today is Wednesday then i selected "Monday" from the list, what i will get is the result for Monday the following week.same goes if i select "Tuesday". BUT if i select Wednesday, Thursday, Friday, Saturday, Sunday, i wll be able to get results from this week. i hope someone could provide me a logic as i hae spent 2 days doing this.

thanks in advance

Re: help with day today and yesterday

Posted: Tue Feb 07, 2012 8:02 pm
by Celauran
Have your select list dynamically generated based on the current day, and have the value be the number of days ahead of today. From there, just use DateTime::modify().