Function Main()
d = "20/05/2023"
Try
console.log("Try CDate(" & d & ")")
d = CDate(d)
Catch err
console.log("!!! Catch Try CDate(d) err:" & err)
Finally
console.log("Finally d:" & d)
End Try
End Function
Am I right in thinking the above code should be caught? I can’t get it to catch when converting a “bad” date, in my case a d/m/yy date with d>12
What‘s wrong with d>12 in a d/m/yy date? d stands for day - so any day between 1 and 31 is valid (if the month is right).
I suspect you mean m>12 - but then your example is wrong.
You‘re using the variable name „d“ for 2 different things it seems - to hold the original date and to hold the day portion of the date.
Thomas