[AccessD] Check date-time problem

Sad Der accessd666 at yahoo.com
Fri Jul 1 00:38:29 CDT 2005


Example:

current time=21:37
StartPauzeAt=21:00
EndPauzeAt=3:00

The following statement checks if current time is
between startpauze and endpauze:
If (dtmCurrentTime > dtmStartPauze) And
(dtmCurrentTime < dtmEndPauze) Then

(dtmCurrentTime > dtmStartPauze) = TRUE
21:37           > 21:00          = TRUE
(dtmCurrentTime < dtmEndPauze) = FALSE
21:37           < 3:00         = FALSE!!

So the problem is that I'm missing a day factor here.
How can I implement this. The StartPauzeAt and
EndPauzeAt are flexibel and can be changed at any
time.

So what I need is:
If dtmCrntDateTime > dtmStartPauze AND dtmCrntDateTime
< dtmStartPauze then
IF 1-jun-2005 21:37 > 1-jun-2005 21:00 AND
1-jun-2005 21:37    < 2-jun-2005 3:00

Hope this makes sence.

SD


--- MartyConnelly <martyconnelly at shaw.ca> wrote:

> So what is the problem, are you running more than 24
> hours?
> 
> Sad Der wrote:
> 
> >Hi group,
> >
> >I've got an ini file with the following values:
> >[PauzeScheduling]
> >StartPauzeAt=21:00
> >EndPauzeAt=3:00
> >
> >I've got a 'service' that checks if the
> Currenttime:
> >dtmCurrentTime = CDate(Format(Time(), "hh:mm"))
> >
> >Is between these values. 
> >
> >It worked fine. Settings used to be within a day.
> >Somebody has got to have dealt with this problem
> >before.
> >What is a (very) solid way to handle this problem?
> >Keep in mind that this is a long running schedule
> >(e.g. forever?!)
> >
> >Thnx.
> >SD
> >
> >Here's my code:
> >
>
>'=========================================================================================
> >' Function Name      :  PauzeScheduling
> >' Parameters         :  dtmCurrentTime => Current
> >Time' Return value       :  (Boolean) True:
> >CurrentTime between scheduled times
> >' Purpose            :  Check if current time is
> >within the scheduled times of the ini file
> >' Assumptions        :  ---
> >' Uses               :  ---
> >' Created            :  2005-Jun-03 08:55, SaDe
> >' Modifications      :
>
>'=========================================================================================
> >Public Function PauzeScheduling(dtmCurrentTime As
> >Date) As Boolean
> >   Dim dtmStartPauze As Date
> >   Dim dtmEndPauze As Date
> >   
> >   On Error GoTo PauzeScheduling_Error
> >   
> >   dtmStartPauze =
> >CDate(Format(g_oGenSet.GetValue("PauzeScheduling",
> >"StartPauzeAt"), "HH:mm"))
> >   dtmEndPauze =
> >CDate(Format(g_oGenSet.GetValue("PauzeScheduling",
> >"EndPauzeAt"), "hh:mm"))
> >   
> >   
> >   If (dtmCurrentTime > dtmStartPauze) And
> >(dtmCurrentTime < dtmEndPauze) Then
> >      PauzeScheduling = True
> >   Else
> >      PauzeScheduling = False
> >   End If
> >
> >PauzeScheduling_Exit:
> >   ' Collect your garbage here
> >   Exit Function
> >PauzeScheduling_Error:
> >   ' Collect your garbage here
> >   Call
> >g_oGenErr.Throw("PauzeScheduling.PauzeScheduling",
> >"PauzeScheduling")
> >End Function
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> >http://mail.yahoo.com 
> >  
> >
> 
> -- 
> Marty Connelly
> Victoria, B.C.
> Canada
> 
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 



		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com



More information about the AccessD mailing list