Hi,
what is your real concern?
a. How to calculate a difference generally or
b. how to calculate the difference
in month?
a. This is rather easy.
The output of the date question is a string like 25/10/2023.
Now you use the function "strtotime(date)" to convert this string into a number, that outputs the number of seconds since 1/1/1970.
The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC)
Now you need the actual date.
You do the same. Convert the actual date into this timestamp.
You may use
- either {strtotime('now')} (These verbatims you find in the manual: Question type "date")
- or {strtotime(date('Y-m-d'))} (here the seconds since midnight are not taken into account)
To get the difference you subtract the two values and get the difference in seconds.
To get the difference in days you only have to divide by 86400.
{(strtotime('now')-strtotime(Q1))/86400}
Fine.
And now the reason why I asked about the difference in month.
Unfortunately there are months with 28 days and months with 31 days. So you can divide the number of days by 30.42 (what is the average length of a month in a regular year)
But this is up to you.
That there are no whole numbers of days is due to the switches from daylight saving time to standard time and viceversa.
Joffm