T
Tom
It appears that you can't compare two dates in DotNet. You must use
ToString and compare the strings. Is that the only reliable way?
Try this:
Dim dteOne As Date = FileDateTime(Application.ExecutablePath)
Dim dteTwo As Date = FileDateTime(Application.ExecutablePath)
SaveSetting("Test", "Dates", "DateThree",
FileDateTime(Application.ExecutablePath))
Dim dteThree As Date = CDate(GetSetting("Test", "Dates",
"DateThree"))
Console.WriteLine(dteOne)
Console.WriteLine(dteTwo)
Console.WriteLine(dteThree)
If dteOne = dteTwo Then
Console.WriteLine("dteOne = dteTwo")
End If
If dteOne = dteThree Then
Console.WriteLine("dteOne = dteThree")
End If
If dteOne.CompareTo(dteThree) = 0 Then
Console.WriteLine("dteOne.CompareTo(dteThree) = 0")
End If
If dteOne.ToString = dteThree.ToString Then
Console.WriteLine("dteOne.ToString = dteThree.ToString")
End If
I get these results:
10/14/2004 2:28:20 PM
10/14/2004 2:28:20 PM
10/14/2004 2:28:20 PM
dteOne = dteTwo
dteOne.ToString = dteThree.ToString
Tom
ToString and compare the strings. Is that the only reliable way?
Try this:
Dim dteOne As Date = FileDateTime(Application.ExecutablePath)
Dim dteTwo As Date = FileDateTime(Application.ExecutablePath)
SaveSetting("Test", "Dates", "DateThree",
FileDateTime(Application.ExecutablePath))
Dim dteThree As Date = CDate(GetSetting("Test", "Dates",
"DateThree"))
Console.WriteLine(dteOne)
Console.WriteLine(dteTwo)
Console.WriteLine(dteThree)
If dteOne = dteTwo Then
Console.WriteLine("dteOne = dteTwo")
End If
If dteOne = dteThree Then
Console.WriteLine("dteOne = dteThree")
End If
If dteOne.CompareTo(dteThree) = 0 Then
Console.WriteLine("dteOne.CompareTo(dteThree) = 0")
End If
If dteOne.ToString = dteThree.ToString Then
Console.WriteLine("dteOne.ToString = dteThree.ToString")
End If
I get these results:
10/14/2004 2:28:20 PM
10/14/2004 2:28:20 PM
10/14/2004 2:28:20 PM
dteOne = dteTwo
dteOne.ToString = dteThree.ToString
Tom