|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Scheduled task exclusion
Greetings members,
I am new to the forum and have searched briefly but couldn't find exactly what i was after, so forgive me if this has been asked before. My question is a simple one , I hope. I have a scheduled task that sends an email on the every hour within 9 am til 5 pm. However, I wish to exclude both Saturday and Sunday from this task. So far, this is what I have, but it is not working. I've used DayofWeek, but I also tried with DayOfWeekAsString, alas, with the same results. ------------------------------------- <cfset TodaysDate = Now()> <CFIF DayOfWeek(TodaysDate) NEQ 6 OR DayOfWeek(TodaysDate) NEQ 7> <cfmail from="server@esi.co.nz" to="markh@cwc.co.nz;" subject="CWC STAFF BREAK"> Wake up! </cfmail> <cfelse> <cfabort> </CFIF> ---------------------------------------- Any ideas? All help appreciated. Mark |
|
#2
|
|||
|
|||
|
The problem is that the dayOfWeek() for Saturday is 7 and the dayOfWeek() for Sunday is 1:
Prints 7: #dayofweek( '7/12/03' )# Prints 1: #dayofweek( '7/13/03' )# So you really want: <CFIF DayOfWeek( Now() ) NEQ 7 OR DayOfWeek( Now() ) NEQ 1> Hope that helps. Brian |
|
#3
|
|||
|
|||
|
Actually you can tighten it up a little like this:
<cfif not listFind( '1,7', dayOfWeek( now() ) )> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Scheduled task exclusion |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|