ok it seemed that it doesn't work, as I suspected, but it did work for todays date +- a few days, so I thought it did work. Coded up this function to do this, which I will also add to the codearcs.
;This Function converts the time from "09 Jun 2008" format to
;the "20080609" format, as an int. This will allow you to see
;whether one date is after another. This can be used to stop a
;program from running before or after a certain date:
;Stops program running after a certain date
If DateInt(CurrentDate()) >= DateInt("09 Jun 2008") End
;Stops Program running before certain date
;If DateInt(CurrentDate()) < DateInt("09 Jun 2008") End
;Program can only run on certain date
;If DateInt(CurrentDate()) <> DateInt("09 Jun 2008") End
Function DateInt%(Date$)
;Local Variables -----
Local D$
Local M$
Local Y$
Local DateResult%
;=====================
;Get Day
D = Left(Date,2)
;Get Month
Select Mid$(Date,4,3)
Case "Jan" M = "01"
Case "Feb" M = "02"
Case "Mar" M = "03"
Case "Apr" M = "04"
Case "May" M = "05"
Case "Jun" M = "06"
Case "Jul" M = "07"
Case "Aug" M = "08"
Case "Sep" M = "09"
Case "Oct" M = "10"
Case "Nov" M = "11"
Case "Dec" M = "12"
End Select
;Get Year
Y = Right(Date,4)
;Result Date
DateResult = Int (Y + M + D)
;Return Result Date
Return DateResult
End Function
|