[AccessD] Check date-time problem

Sad Der accessd666 at yahoo.com
Thu Jun 30 00:34:57 CDT 2005


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 



More information about the AccessD mailing list