Troubleshooting
Problem
This technote is a little example of code that returns the number of days between the current date and a hard-coded date in the format DD-mmm-YYYY
Resolving The Problem
Declare Function TimeSpanInDays (beginDatum As Variant, endDatum As Variant) As integer
Sub Main
Dim Result As Integer
print TimeSpanInDays(CVdate("01-Jan-2005"),Date)
End Sub
Function TimeSpanInDays (beginDatum As Variant, endDatum as Variant)
Dim counter As integer
if CVDate(beginDatum)>CVDate(endDatum) then
print "The first parameter must be smaller than the second"
TimeSpanInDays = -1
exit Function
End if
counter =0
while CVdate(beginDatum) <> CVDate(endDatum)
beginDatum = beginDatum+1
counter = Counter+1
Wend
TimeSpanInDays = counter
End Function
Historical Number
26053
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21127731