Select to view content in your preferred language

DiffDate() and Today () not working as expected in Dashboards

894
3
Jump to solution
08-26-2024 10:27 AM
Labels (1)
LindseyGreidanus
Occasional Contributor

I am trying to get a simple count of days till the end of the year and for some reason Arcade is not preforming calculations with Today() like I am expecting. 

When I use the code :

DateDiff(date(2025,1,1), date(2024,8,26), 'days' ) -> I get 128 days
 
But when I use the code:
 
DateDiff(date(2025,1,1), date(today()), 'days' ) -> I get 159 days
 
I am using the advanced formatting window on an indicator in a dashboard.
Is there something obvious I am missing here? Why would the today() function add 30 extra days?
 

 

0 Kudos
2 Solutions

Accepted Solutions
jcarlson
MVP Esteemed Contributor

In the function Date, the second parameter is the month number, but it's zero-indexed. Meaning 0 = January, etc. So 8 is September.

- Josh Carlson
Kendall County GIS

View solution in original post

ChrisUnderwood
Esri Regular Contributor

You might also be able to utilise the ISOMonth function which offers "Values range from 1-12 where January is 1 and December is 12."

https://developers.arcgis.com/arcade/function-reference/date_functions/#isomonth

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

In the function Date, the second parameter is the month number, but it's zero-indexed. Meaning 0 = January, etc. So 8 is September.

- Josh Carlson
Kendall County GIS
LindseyGreidanus
Occasional Contributor

Thank you!

 

ChrisUnderwood
Esri Regular Contributor

You might also be able to utilise the ISOMonth function which offers "Values range from 1-12 where January is 1 and December is 12."

https://developers.arcgis.com/arcade/function-reference/date_functions/#isomonth