type mismatch - converting to date

1537
5
03-26-2019 04:40 PM
DannielaCardenas
New Contributor III

Hi,

I have a database with some information of some people, within the birthday of them, but I want to convert this field that is a String into a Date (type field). For this, I am using the function date(). But I am receiving this error when I try to execute the sheet.

Here is the sheet extract:

With results of the two first lines (field_4 and field_4a):

What I try to do in the field_4a is to subtract only the date of this data, so the function would work.

So I thought that with the result of dia (field_4a), the function date() could calculate the date field type because when I fill this field (4a) by hand it works!

Ok, it does not work perfectly (it subtracts a day but I can handle it), but at the least, the function read the string and converts it into a date. Have you any idea of what it is happening when I try to execute the first extract of the sheet that I showed to you? Thank you very much!

0 Kudos
5 Replies
JamesTedrick
Esri Esteemed Contributor

Hi,

On the day being off - Survey123 uses UTC time and a date is stored as midnight; if you are located in the western hemisphere, the local time displayed will be the day before (as midnight UTC is still the previous day). 

On the time calculation - I'm not seeing the behavior when I create a form with the formulas (excepting the pulldata function). Can you share a copy of the XLSForm that does not validate?

0 Kudos
DannielaCardenas
New Contributor III

Hi! I send you the file of the survey (but I only let four lines in the .csv file)

Atencion domiciliaria Cali.rar - Google Drive 

0 Kudos
ryanEvanczyk
Occasional Contributor

I'm having a similar problem. I have a form that calculates a person's age from a date of birth text field. It works in my original form, but not when I copy and paste into my new form. I'm getting the same error a "type mismatch."

I tried deleting the cells and then rewriting from scratch and that didn't work.

Cheers,

RyanE

0 Kudos
JuanC_Alvarez
New Contributor II

I had a similar problem and the only way to solve it was building the date in ISO format, like this:

Juan_CarlosAlvarez_0-1614185676956.png

it's a bit late, but it works,

JC

 

 

js80540
New Contributor II

Has anyone found a better way yet?
I believe i am having the same issues, this seems counter productive.
Thanks for the trick though! It sure helps in the meantime!