How to write an If-Then statement with DateTime function

“How to write an If-Then statement with DateTime function”
For some reason I can’t figure out how to write this.
The problem is when it returns Nil

The issue:
I put my DateTime.FromString code into a function (called DatSQLTest) with a return of a DateTime object.
I also put the code for exception handling in the function.
But it can return Nil.

My question is how do I write this so the function isn’t called twice.

The basics of the equation are:
Var dStr as string = “2005-01-01 12:00:00”//Actually any SQLDate
Var d1 as DateTime
d1 = DatSQLTest( dStr, CurrentMethodName )

Can’t you just test d1 for Nil and then do the rest of your processing? Or am I missing the question?

Never mind. I’m afraid I was being silly in the head.

I tried to parse it and ended up with:

Semantic content: Nil.

for some reason my brain was elsewhere today