KB-19299: Comparing dates in a script.

Question:

How can two dates from two different sources be compared to each other?

Solution:

To do so, you must use CDate() command to format the dates before they are compared.

Sample script to be executed at a button’s Click event: 

Set Data1 = Application.GetObject(“Data.DataTag1″).Value
Set Data2 = Application.GetObject(“Data.DataTag2″).Value

If CDate(Data1) = CDate(Data2) Then
    MsgBox “Same”
Else
    MsgBox “Different”
End If

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *