Create Multiple Date Values
I'm trying to create a simple coldfusion script to display the correct operating hours of a building based on the date. I've got it working but I would like to add multiple dates to some of the rules. ie. If it is 5/3/11 or 5/4/11 or 5/5/11 display xyz hours. Here's what I've got thus far.
<cfoutput><h3>Today is #DateFormat(Now(),"dddd, mmmm d, yyyy")#</h3>
<cfset dow = dayofWeek(now())>
<cfset doy = dayofYear(now())>
<p>Building Hours: <cfif doy is #dayofYear(CreateDate(2011, 5, 9) or (2011, 5, 10)#>12:00pm - 8:00pm<cfelseif doy is #dayofYear(CreateDate(2011, 5, 11))#>8:00am - 6:00pm<cfelseif dow is 2 or 3 or 4 or 5>6:00am - 10:00pm<cfelseif dow is 6>6:00am - 8:00pm<cfelseif dow is 7>10:00am - 8:00pm<cfelseif dow is 1>10:00am - 10:00pm</p></cfif>
If statements must be "[comparison] OR [comparison]", not "if something is this OR that".
So your first cfif should look something like this:
Thanks. It works. So cool!
|All times are GMT +1. The time now is 11:15 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.