My Account


Home Forums General subtraction in date calculation

Viewing 2 reply threads
  • Author
    • #115672
      Michael Carter

      Hi All,

      I’m trying to subtract a specific number of days from a date generated by the user.
      I’ve been able to calculate a date in advance using * and it works fine, but when i use the – it doesn’t work.
      This is the default value I’m using, #text(#field_date_offset(20, #calc(#seconds_day – 45))) any thoughts on how to achieve this please ?
      *** Ultimately, I’m trying to let a user enter their passport issuance date into a field, I have a default value already that generates a date 5 or 10 years in advance which becomes their expiry date. Then based on the expiry date generated, i need another field to show a date 45,90 and 180 days prior to the expiry date.

      Thanks in advance for any feedback.

    • #115898
      Mark Westguard

      Hi Michael

      #calc(#seconds_day – 45) equates to:

      #calc(86400 – 45) = 86355

      This is still a positive number.

      To create a negative number you’d need to do something like:

      #calc(#seconds_day * -45)

      Or you could just literally enter a negative number, the #calc in this case is unnecessary.

      #text(#field_date_offset(20, -3888000))



    • #115912
      Michael Carter

      Thanks heaps Mark, that makes sense. Appreicate your help as usual 🙂

Viewing 2 reply threads
  • You must be logged in to reply to this topic.