Date off by a month using Arcade

856
4
Jump to solution
05-13-2020 02:37 AM
BertKraan1
Occasional Contributor III

A collegue used collector to record some records but a datefield wasn't filled. I decided to use arcade to fill the field:

But instead of May 11th I see June 10th. This is so confusing.

I understand that date is stored in utc but displayed in my local timezone (I'm near Amsterdam) so I was expecting some hours difference but this seems more than a month.

What am I doing wrong?

regards,

Bert

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

When using the Date function, months are defined by 0-11 instead of 1-12.

monthNumberThe month (0-11) where 0 is January and 11 is December.

View solution in original post

4 Replies
KenBuja
MVP Esteemed Contributor

When using the Date function, months are defined by 0-11 instead of 1-12.

monthNumberThe month (0-11) where 0 is January and 11 is December.
JonathanJew1
New Contributor

Can anyone explain why the month() would be indexed at 0, while day() and year() actually returns what one would expect? Python treats months consistently, and I just can't wrap my head around why arcade would have been designed this way. 

 

DanThompson
New Contributor II

yeah it makes no sense..

0 Kudos
bogrevy
Esri Contributor

Although it is stated in the documentation for both the Date function and the Month function, it makes no sense at all that this is 0-based.

The problem with changing that is that any existing arcade expressions that use these functions will fail. I would still recommend Esri to change these features instead of continuing to bear the pain all the following years.

0 Kudos