Type mismatch converting text to date

99
0
12-02-2021 06:38 AM
Chris_976
New Contributor II

Hello there !

I'm coming accross some behaviour I can't explain no matter how many times I try to read and understand what @IsmaelChivite explains us in the post 'Dates and Time in Survey123' :

I have a form where I want my users to type a date of birth, and I find it easier for them to do that in a tex field formated as 'jj/mm/yyyy'.
Then I need to use this date to do the simple calculation of the age, so I calculate a text string to meet the ISO format

ChristopheAgnes_1-1638454808301.png

So from there I would expect the date(${ISOformatedDate}) function to give me the date in ESRI format and use it for calculation like "int((decimal-date-time(today()) - decimal-date-time(date(${ISOformatedDate})) div 365.25)". But the first step of using the date() function alone raises the error "Type mismatch converting text to date".

Moreover, when I try to calculate a date type field with the ISO formated string, it seems to work fine. But the same error is then raised when trying to use this field in another calculation...

So what's going on there and how can I do ?

Here is a sample of my sheet and, FYI, I'm using Survey123 Connect v.3.13

Cheers!

- - -
Christophe AGNES
GIS Head @ Mayotte's public institution for land and country planning
0 Kudos
0 Replies