Calculate month between dates Survey123

1057
2
Jump to solution
01-11-2021 12:56 PM
FedericoRiet_Sapriza
New Contributor III

Hi

I'm trying to calculate the number of months between dates, but I don't get the correct answer I try with decimal and epoch time

FedericoRiet_Sapriza_0-1610398333888.png

This is the answer is get in Survey123, shouldn't be 24 months?

FedericoRiet_Sapriza_1-1610398385141.png

 

Thanks in advance for your help.

Cheers,

Federico

 

@IsmaelChivite @JamesTedrick 

0 Kudos
1 Solution

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi @FedericoRiet_Sapriza 

Thanks for the screenshot of your XLSForm. Try using the round() function in your calculation, instead of int(). As described in this GeoNet post, in the field app the int() function discards the decimal places. Here is the calculation split into a few questions - you can see the number of months should be rounded to 24:

Jim-Moore_1-1613455420159.png

Jim-Moore_0-1613455067435.png

Hope this helps,

Jim

View solution in original post

2 Replies
Jim-Moore
Esri Regular Contributor

Hi @FedericoRiet_Sapriza 

Thanks for the screenshot of your XLSForm. Try using the round() function in your calculation, instead of int(). As described in this GeoNet post, in the field app the int() function discards the decimal places. Here is the calculation split into a few questions - you can see the number of months should be rounded to 24:

Jim-Moore_1-1613455420159.png

Jim-Moore_0-1613455067435.png

Hope this helps,

Jim

FedericoRiet_Sapriza
New Contributor III

Hi Jim,

this awesome and very well explained!!!

Thanks so much!!

Cheers,

Federico

0 Kudos