1

I'm trying to subtract the date today and a numeric number.

The formula that I'm thinking of is NOW() - NumberOfDays__c.

Output should be in date format (DD/MM/YYY or MM/DD/YYYY)

Any ideas on how to achieve this?

Thank you!

1
  • My apologies, I missed the Einstein tag. I don't have an answer for this.
    – sfdcfox
    Aug 3, 2020 at 4:50

1 Answer 1

0

First, convert the now()-Date to epoch seconds, then substract the desired number of days (multiplied by 24 * 60 * 60 = 86400). Then convert this epoch seconds value back to a date.

 toDate(date_to_epoch(now()) - (NumberOfDays__c * 86400))

Edit: forgot the 24 multiplier...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.