# Calculate a date that is always "next month"

458
5
01-13-2023 09:08 AM
by
Occasional Contributor III

Hello!

Every time a survey is submitted, I need to calculate a date that is always 24 days after the 1st day of the next month. (the expiration date)

I managed to do the following but I need to update the date in yellow every month, and I am afraid if I forget only once everything will go wrong.

Is there a way I can set a "next month" rule?

Thanks!

Tags (1)
5 Replies
Esri Regular Contributor

Hello @PanGIS

Is the survey record being updated each month, or are you looking for the data in the feature service to be updated every month?

Thank you,
Zach
by
Occasional Contributor III

The date in that field is created only once and it never changes.

The record is an inspection that will be updated with other surveys but that Date field stays the same until the case is closed (the case is closed when that date passes).

If today, or any day of this month, I run an inspection, the date recorded in that field is the 25th of February.

For any inspection run in February, the date recorded in that field is the 25th of March.

(the date in my screenshot is updated already for the inspections of February)

MVP Esteemed Contributor

Could you check if replacing the manual date ('23-03-01') with the following expression works (for minDate)

``EOMONTH(TODAY(),0)+1``

Think Location
by
Occasional Contributor III

Thank you @JayantaPoddar

You got exactly what I need but I am struggling with the function.

is that "eomonth" function supported?

If I replace with this:

 if(1=1, 'EOMONTH(TODAY(),0)+1', if(1=0, '0000-00-00','1111-11-11'))

The calculation results in a string: 'EOMONTH(TODAY(),0)+1' not a date

this means that when I try to add 24 days to my date field field I get an error.

(also tried to bind the field as date but nothing).

I also tried the following, instead of the previous string:

date(decimal-date-time(eomonth(\${inspection_Date},0)+1)) , not sure if it make sense, but I get a error in calculating the expression.

I am attaching the xls as soon as I get back to my desk.

by
Occasional Contributor III

@JayantaPoddar  in case you have 5 minutes to spare, here attached a xls with three samples.

The first one is the one that works.

Thanks!