subtract specific number of days from date and compare that date with current date

Silver Contributor
Silver Contributor

Hi,

I will push a date from the source to Tealium. In Tealium, I want to subtract 4 days from that date and get that output as date. And then I want to compare the date from the output with the current date. Is this possible to do?

Thanks,
Magesh

1 REPLY 1

subtract specific number of days from date and compare that date with current date

Tealium Employee

Hi @Mageshsm 

So do do that you can use this logic:

Step Attribute Name Attribute Type Default Value Enrichment
1 vNumZero Number (Int) 0  
2 vNum60000 Number (Int) 60000  
3 vNum4DaysMS Number (Int) 345600000  
4 vDtEpoch Date   Set Date to vNumZero
5 vDtNow Date (The base date you want to use)  
6 vNumNowEpochMin Number (Int)   Set Number to be the difference between vDtEpoch and vDtNow in minutes
7 vNumNowEpochMS Number (Int)   Set Product to vNumNowEpochMin multiplied by vNum60000
8 vNumNowMinus4DaysEpochMS Number (Int)   Set Difference  to vNumNowEpochMS minus vNum4DaysMS
9 vDtNowMinus4Days
Date  
Set date to vNumNowMinus4DaysEpochMS

Just to note you may need to use the attribute search tool which is the pop-out icon to find number attributes when on the Date enrichments.

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Public