>- see footer for list info -<
> Are you trying to get DayOfWeek and DayOfWeekAsString to return
different ordinal
> values in all cases?
>
> If so you could try writing a simple alternative DayOfWeek function to
handle this.
Yeah, that's a good idea.
The situation is that I'm writing some scheduler code that allows users
to select one or more days of the week and (separately) months of the
year. The database against which I'm working stores a bitmask of the
days selected, but where 1=Monday ~ 7=Sunday (so 5 = Monday and
Wednesday).
However, having asked the question and rolled up the old shirt-sleeves,
I think that worrying about changing the date values isn't probably the
way to go.
So far, I've got a generic bitmask component (below) and am about to
write getValues(), which I suspect should probably return a 1D array of
powers of 2 that make up the current bitmask value. Then, when storing
the values, I can supply addValue() not with the direct value of 1~7,
but with the whatever value is stored in it's position in a 2D array
like this
[1] = 7
[2] = 1
...
[7] = 6
which will allow me to offset the days. Not having done this before, I'm
slightly winging it (and am probably coming across as a bit
harf-assed)...
<cfcomponent output="no">
<cfset setBitmask(0)>
<cffunction name="addValue" returntype="void" output="false">
<cfargument name="iValue" type="numeric" required="yes">
<cfset setBitmask(getBitmask() + (2 ^
arguments.iValue))>
</cffunction>
<cffunction name="getBitmask" returntype="numeric"
output="false">
<cfreturn variables.iBitmask>
</cffunction>
<cffunction name="getValues" returntype="void" output="false">
</cffunction>
<cffunction name="setBitmask" returntype="void" output="false">
<cfargument name="iBitmask" type="numeric"
required="yes">
<cfset variables.iBitmask = arguments.iBitmask>
</cffunction>
</cfcomponent>
--
Aidan Whitehall [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental +44 (0)1695 51775
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<