Extracted Date is 90 Days Less than Todays Date

Hi

I have extracted a date from an email in the format of yy/mm/dd and I would like to be able to check if the extracted date is 90 days less than todays date.

Can someone help please.

Hi Richard,

First you need to convert your string values into dates…
{{date custom.ExtractedDate from_format=“Y/m/d”}}

Then render the date to compare it to…
{{date subtract=“90 days”}}

Then compare the extracted date the comparison date in a Step condition.
Extracted date is within 90 days
custom.RenderedExtractedDate > custom.RenderedComparisonDate

Extracted date is older than 90 days
custom.RenderedExtractedDate < custom.RenderedComparisonDate

Hope this helps.

Thank you @Mark it was a great help.

Thanks Mark! This post plus the docs on Date Formats (Date Formats | MSPintegrations) helped me a lot!

Good Afternoon Mark

Sorry to hijack this thread but could you perhaps clarify the steps used to implement this date check i have the same use case.

I have Queried a date on a specific ticket storing it in a variable called CaptureDate i now need to pass a command that checks if that date is 90 days or older I created a perform a regular expression Match
my condition looks like this

custom.CaptureDate <= “/date_diff("days", custom.original_ticket.Ticket.CreateDate, now()) > 90/”

This is my pattern
/date_diff(“days”, custom.original_ticket.Ticket.CreateDate, now()) > 90/

Subject is
{{custom.CaptureDate}}

You don’t want to use (can’t use) the regex that way. Here’s some clarification to Mark’s examples, so hope this helps.

Right now, you have the date you want already extracted. Which is custom.CaptureDate. That’s the date you want to compare to.

Following Mark’s example, you need to convert that extracted date, which is a string, into an actual date. So first, you render a new variable called custom.RenderedExtractedDate
{{date custom.CaptureDate from_format=“Y/m/d”}}

Next, you need to know what 90 days ago is. From today, not from your extracted date.

You’ll render a variable as a date that gets you that information. Let’s call it RenderedComparisonDate and it’s value is {{date subtract=“90 days”}}

Now you have two custom variables, one with the date you extracted and one which is 90 days before today. Since both are “date” type variables, you can compare them.

Extracted date is within 90 days.
custom.RenderedExtractedDate > custom.RenderedComparisonDate

Extracted date is older than 90 days
custom.RenderedExtractedDate < custom.RenderedComparisonDate

You would put that in the condition on the step. So if you only wanted to take action if it’s older than 90, you would use the custom.RenderedExtractedDate < custom.RenderedComparisonDate