Fixing Date Calculations please e.g dd/mm/yy - dd/mm/yy [RESOLVED]

Hi,

Does anyone know what I’m doing wrong please?

I have two dates in my form e.g Booking 1, Booking 2
When I use the calculation:
{Date of Booking1:8} - {Date of Booking2:9}
It returns a strange looking number I think I need to format? I’m using dd/mm/yy (Australia)

When I do for instance 1st March & 8th March (7 days) - it comes up as 7,000,000
So I update ({Date of Booking1:8} - {Date of Booking2:9}) / 1000000 and it shows 7 :tada:

But… if I do 28th February & 8th March (8 days) - it comes up as -19,990,000 - and I’ve got no idea how to format that!

So I’m thinking it’s something to do with dd/mm/yy?

Would anyone have any ideas please?
Thank you!

P.S I found Calculate Number of Days Between Two Dates - Gravity Wiz but I’m hoping to use it on every single form and as the calculation seems to be almost working I didn’t think I need to add all that code :slight_smile:

Hi,

Gravity Forms by default doesn’t support Date calculations so the issue you’re experiencing isn’t because of the date format. You’ll definitely need a custom snippet to get it done, and our free snippet you found is one you can use. If you’re looking for a non-coding solution that is easier to use, then you can check out our GP Date Time Calculator Perk.

Best,

2 Likes

Thanks Samuel - if I instead use Calculate Number of Days Between Two Dates - Gravity Wiz - do you know how I’d do that for all my forms in various fields.

Is there a way to do it like a calculation?
Eg one form it would be field 12 and another form field 16 - that’s what stopped me

Thanks :slight_smile:

You’ll have to create multiple instances of the GWDayCount Class by duplicating just the Configuration part at the bottom of the snippet. So you would have multiple configurations depending on the number of forms and fields. Here is a documentation with more details on how to do this.

I hope this helps.

Best,

Thanks Samuel :slight_smile: