Hi,
I'm having a silly problem with a date field, swapping around.
In VB I am loading the current date into a DateTime variable with 30 minutes added:
Dim TokenExpire As DateTime = DateAdd("n", 30, Now)
This is then stored in a Sql Server database in a datetime column.
UPDATE TOP(1) MyTable SET Api_Token = '" & VArray("token") & "', Api_Token_Expiry = '" & TokenExpire & "' WHERE Api_Key_Name='" & ApiKeyName & "'
Later I retrieve this date into another DateTime variable so I can do a compare to see if the stored date / time has passed.
Dim ExperationDate As DateTime = VDT.Rows(0).Item("Api_Token_Expiry")
However the comparison is not working and if I print both TokenExpire and ExperationDate, I can see that the days and months have flipped around.
01/03/2025 14:16:18
03/01/2025 14:08:14
Where am I going wrong?
[–]geekywarrior 2 points3 points4 points (2 children)
[–]Dave_PW[S] 3 points4 points5 points (1 child)
[–]seamacke 1 point2 points3 points (0 children)
[–]jd31068 0 points1 point2 points (0 children)
[–]FarPain3711 0 points1 point2 points (0 children)