xsharp.eu • CToD() return NULL_DATE
Page 1 of 1

CToD() return NULL_DATE

Posted: Sun Jun 07, 2020 7:37 pm
by boonnam
I came across an unexpected result when trying to test our converted X# application.

Code: Select all

        local cDate as String
        cDate := Str(5,2,0) + "/01/" + Str(2020,4,0)
        local dDate as Date
        dDate := CToD(cDate)
        ? dDate
        Console.ReadKey()

In VO dDate would be "05/01/2020", but in X#, it is NULL_DATE. The reason is because of a space in front of the month. In this case cDate is actually " 5/01/2020". If I trim cDate before converting to date, then the result is the same as in VO.

Code: Select all

dDate := CToD(AllTrim(cDate))
This line get the correct date. I know VO is very forgiving. I don't mind trimming the string before trying to convert it to a date, but can you guys take a look at this? Thanks.

Boonnam

CToD() return NULL_DATE

Posted: Mon Jun 08, 2020 6:57 am
by robert
Boonnam,
Confirmed.
We will fix this for the next build.

Robert

CToD() return NULL_DATE

Posted: Mon Jun 08, 2020 12:36 pm
by Chris
It's fixed now!