Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Find number of days between system date and Offer date

Avatar

Avatar
Validate 1
Level 2
akramullak35861
Level 2

Likes

8 likes

Total Posts

23 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 5
View profile

Avatar
Validate 1
Level 2
akramullak35861
Level 2

Likes

8 likes

Total Posts

23 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 5
View profile
akramullak35861
Level 2

15-04-2020

In ACC WebApp I am trying to get the number of days between System date and Offer date with the below syntax but I dont get anything, even tried converting just to "%2M/%2D/%4Y" that also does not work when used with DaysDiff function. 

 

ctx.vars.OfferDate= formatDate(ctx.recipient.Offer_Date,"%2M/%2D/%4Y %02H:%02N:%02S");

ctx.vars.SysDate = formatDate(getCurrentDate(),"%2M/%2D/%4Y %02H:%02N:%02S")

ctx.vars.datediff = DaysDiff(ctx.vars.OfferDate, ctx.vars.SysDate )

 

Also tried javascript  syntax, this also does not work

ctx.vars.SysDt=ctx.vars.SysDate.getTime();

ctx.vars.OfferDt =ctx.vars.OfferDate.getTime(); 

ctx.vars.Time_Diff = ctx.vars.SysDt - ctx.vars.OfferDt;
ctx.vars.Date_Diff = ctx.vars.Time_Diff/(1000 * 3600 * 24);

 

 

 

 

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

960 likes

Total Posts

1,087 posts

Correct Reply

507 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

960 likes

Total Posts

1,087 posts

Correct Reply

507 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

20-04-2020

Hi,

 

The JS is:

 

new Date() - new Date(ctx.vars.OfferDate)

 

 

Be aware that you're comparing 2 clocks here- the one on the db server and the one on the app server.

A more consistent approach would be to do the math on the db: DaysAgo(@Offer_Date) or whichever resolution is desired.

 

Thanks,

-Jon

Answers (3)

Answers (3)

Avatar

Avatar
Give Back 5
Level 4
prasannakumarmarru
Level 4

Likes

50 likes

Total Posts

59 posts

Correct Reply

17 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile

Avatar
Give Back 5
Level 4
prasannakumarmarru
Level 4

Likes

50 likes

Total Posts

59 posts

Correct Reply

17 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile
prasannakumarmarru
Level 4

18-04-2020

Hi,

You should use GetDate() function  instead of getcurrentdate()

Thanks!

Avatar

Avatar
Validate 1
Level 2
akramullak35861
Level 2

Likes

8 likes

Total Posts

23 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 5
View profile

Avatar
Validate 1
Level 2
akramullak35861
Level 2

Likes

8 likes

Total Posts

23 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 5
View profile
akramullak35861
Level 2

15-04-2020

Avatar

Avatar
Validate 1
Level 2
akramullak35861
Level 2

Likes

8 likes

Total Posts

23 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 5
View profile

Avatar
Validate 1
Level 2
akramullak35861
Level 2

Likes

8 likes

Total Posts

23 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 5
View profile
akramullak35861
Level 2

15-04-2020

Can someone move this query to Adobe Campaign Classic please.