Yes, the hour is from 0-23, military time.

>>> "Owens, Howard" <[EMAIL PROTECTED]> 03/21/02 02:30AM >>>
Thanks for the tip, Ben.   I've been testing this out and so far it works
like a charm.  

Question:  For the hour I'm using military time, in this case "15" for 3
p.m. eastern time. I assume if I put "3" the server will think I mean 3 a.m.

H.


> -----Original Message-----
> From: BEN MORRIS [SMTP:[EMAIL PROTECTED]] 
> Sent: Wednesday, March 20, 2002 11:39 AM
> To:   CF-Talk
> Subject:      Re: Date Comparison Issue
> 
> I have done...
> 
> <cfset l_TurnOffDate = CreateDateTime(2002, 4, 16, 3, 0, 0)>
> 
> <cfif Now() GT l_TurnOffDate>
>   past deadline code...
> <cfelse>
>   before deadline code
> </cfif>
> 
> It works for me.
> This is designed for a Pacific deadline as well, so I just made it 3am
> eastern (timezone where my server is)
> 
> >>> "Owens, Howard" <[EMAIL PROTECTED]> 03/20/02 02:17PM >>>
> I have this application that has an element that is supposed to end on a
> predefined date and time.
> 
> I set the end date and time in the Application.cfm, then have a template
> that runs the code below.
> 
> Two questions:
> 
>       1.) Is this the most efficient and straightforward way to do this.
>       2.) I have some logic problem ... the month comparison isn't working
> right.  If the application begins running in Feburary (for example), the
> section that is supposed to be on is OK, but then on the 1st of the month,
> it stops working.  For example, if the code is supposed to end on 3/7,
> everything works from 2/8 until 3/1, then it stops and won't start working
> again until 3/8. 
> 
> If you're wonding about the dateadd part and the -3, our servers are on
> the
> east coast, our time is west coast.
> 
> Here's the code:
> 
> 
> <!--- application end times are set on the application.cfm page --->
> 
> <!--- param for auction over --->
> <cfparam name="request.AppStatus" default="">
> 
> 
> 
> <!--- first we need to set the month parts we're dealing with --->
> <cfset TodayMonth="#DatePart('m', Now())#">
> <cfset MonthEnd="#DatePart('m', "#request.AuctionEnd#")#">
> 
> 
> 
> <!--- now we test to make sure we haven't reached the final month of the
> auction --->
> <CFIF NOT TodayMonth lt MonthEnd>
> 
> 
> <!--- if this is the final month, we need to set the day and hour parts
> --->
> <cfset TodayDate="#DatePart('d', Now())#">
> 
> <cfset TodayTime="#DateAdd('h', '-3', Now())#">
> <cfset TodayTime="#DatePart('h', TodayTime)#">
> 
> <cfset DateEnd="#DatePart("d", "#request.AppEnd#")#">
> <cfset TimeEnd="#DatePart("h", "#request.AppEndTime#")#">
> 
> 
> 
> 
> <!--- if today's date is greater than or equal the end date, keep the
> processing going --->
> <cfif TodayDate GTE DateEnd >
> 
> <!--- if the processing is going, check to see if the time has expired on
> hours --->
> <cfif TodayTime GT TimeEnd >
> 
>       <cfset request.AppStatus="Over">
>       
>       <cfelse>
>       <!--- if the first test of the day passes, the time test will only
> be true from 9 p.m. to midnight; so after the date expired, we want to
> make
> it permenant that the App is over --->
>                       <cfif TodayDate GT DateEnd >
>                       <cfset request.AppStatus="Over">
>                       </cfif>
>       
> </cfif>
> 
> </cfif>
> 
> 
> </cfif>
> 
> 
> 
> 

______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to