here is what i came up with.
may have been an adaption of someone elses
something, but its what i use


<cfcomponent displayName="isDateInDayLightSavingsTime" hint="The hint
is in the question I say!">

        <cffunction name="isDateDST" access="public" output="1" 
returntype="any">
        
                <cfargument name="dateFeed" type="date" required="Yes"/>        
                        

                        <cfset startDate = 
"04/01/#dateFormat(arguments.dateFeed,'yyyy')#">
                        <cfset endDate = 
"11/01/#dateFormat(arguments.dateFeed,'yyyy')#">
                        
                        <cfif NOT (dayOfWeek(startDate) eq 1)>
                                <cfset targetDOW = 8 - dayOfWeek(startDate)>
                        <cfelse>
                                <cfset targetDOW = dayOfWeek(startDate)>
                        </cfif>
                        
                        <cfset beginDST = dateAdd('d',targetDow,startDate)>
                        
                        <cfif NOT (dayOfWeek(endDate) eq 1)>
                                <cfset targetDOW = 1 - dayOfWeek(endDate)>
                        <cfelse>
                                <cfset targetDOW = dayOfWeek(endDate)>
                        </cfif>
                        
                        <cfset endDST = dateAdd('d',targetDow,endDate)>
                        
                        <cfif (dateDiff('d',beginDST,arguments.dateFeed) GTE 0) 
and
(dateDiff('d',endDST,arguments.dateFeed) LT 0)>
                        
                                <cfset withinDST = 1>
                                
                        <cfelse>
                        
                                <cfset withinDST = 0>
                        
                        </cfif>

                        <cfreturn withinDST/>

        </cffunction>
        
</cfcomponent>                  


On 5/11/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> I just downloaded and am picking it apart - thanks!
>
> On 5/11/06, Paul Hastings <[EMAIL PROTECTED]> wrote:
> > Aaron Roberson wrote:
> > > I have a banner that displays on the site every Wednesday at 2:00
> > > p.m.. However, I am afraid that when daylight savings time ends in
> > > October I am going to have to rewrite my code.
> > >
> > > It's a matter of chaning the value of a single variable, but what
> > > happens when I move on and another developer overseas the project?
> > > He/she won't know why that banner isn't displaying at the correct
> > > time.
> >
> > if all you need is to see is if a date is in DST in different timezones,
> > use the timezone CFC:
> >
> > http://www.sustainablegis.com/projects/tz/testTZCFC.cfm
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240243
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to