
1. Re: Date calculation anomaly?
mikebeargie Sep 1, 2015 7:57 AM (in response to jaredb_gtn)Is your server in the same timezone that you are?

2. Re: Date calculation anomaly?
jaredb_gtn Sep 1, 2015 8:01 AM (in response to mikebeargie)It is, however if I evaluate the following in data viewer it shows the same.
Date (Month("08/31/2015") +1; Day ("08/31/2015") + 15;Year ("08/31/2015")  1 )
Date (Month (Get ( CurrentDate )) +1; Day (Get ( CurrentDate )) + 15;Year (Get ( CurrentDate ))  1)

3. Re: Date calculation anomaly?
mikebeargie Sep 1, 2015 8:09 AM (in response to jaredb_gtn)Actually it's because in your day() + 15 calculation, you're ending up in the next month because you're adding 15 days onto the 31st.
So you need something to account for when the amount of days calculated will exceed the amount of days in the target month.

4. Re: Date calculation anomaly?
DavidJondreau Sep 1, 2015 8:39 AM (in response to jaredb_gtn)You're getting the correct result.
What result do you want to get?If the input is 8/31/2015, what do you want the output to be?

5. Re: Date calculation anomaly?
jaredb_gtn Sep 1, 2015 8:31 AM (in response to mikebeargie)I modified the calculation a bit to calculate the month in days which seems to have resolved the issue.
Date (Month (Get ( CurrentDate )); Day (Get ( CurrentDate )) + 45;Year (Get ( CurrentDate ))  1)
This should give me nearly the same results I am looking for.
I think I understand what is happening now  Putting the following calc in to Dataviewer clarified things for me.
Day ("08/31/2015") + 15 = 46 days (It's adding 1 month plus the 15 days)
Day ("09/01/2015") + 15 = 16 days (It's adding 15 days to the current date)
Now my question is. If what is true above, then why did this not evaluate to 11/16/2014
Date (Month("08/31/2015") +1; Day ("08/31/2015") + 15;Year ("08/31/2015")  1 )
Wouldn't it be adding a month twice?

6. Re: Date calculation anomaly?
jaredb_gtn Sep 1, 2015 8:32 AM (in response to DavidJondreau)It should be the next day. Essentially a 45 day notice to an anniversary date.

7. Re: Date calculation anomaly?
mikebeargie Sep 1, 2015 8:39 AM (in response to jaredb_gtn)This:
Date (Month("08/31/2015") +1; Day ("08/31/2015") + 15;Year ("08/31/2015")  1 )
Is equal to this:
9/1/2014 + 46
Not 9/1/2014 + 15
So I would expect that to return 10/15/2014
If the day portion of your calculation didn't exist, the rest of the calculation would evaluate to 9/1/2014. So when you add back in the 46 days that you noted Day ("08/31/2015") + 15 gives you, you end up around 10/15/2014
filemaker does not turn 46 days into 1.5 months and add 1.5 months, it adds 46 days from a relative date point. In your case based on the rest of the calc, that date is 9/1/2015. It adds 46 days to that, and you end up in midoctober 2014.

8. Re: Date calculation anomaly?
DavidJondreau Sep 1, 2015 8:42 AM (in response to jaredb_gtn)Try this:
Let([
today = get ( CurrentDate ) ;
m = Month ( today ) ;
d = Day ( today ) + 45 ;
y = Year ( today )  1 ;
result = Date ( m ; d ; y )
];
result
)
*Looks like you already figured that out...

9. Re: Date calculation anomaly?
mikebeargie Sep 1, 2015 8:43 AM (in response to DavidJondreau)This calc would just give the same result as his original calc right?

10. Re: Date calculation anomaly?
jaredb_gtn Sep 1, 2015 8:47 AM (in response to jaredb_gtn)Much appreciated mikebeargie DavidJondreau

11. Re: Date calculation anomaly?
DavidJondreau Sep 1, 2015 8:47 AM (in response to mikebeargie)No, the original calc was based on the assumption that all months were 30 days long. That's the source of the error. Add a month, add 15 days you get 45 days, right? Nope.
By leaving the month the same, and just using the 45 day criteria you get the correct result.