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

Getting NaN when I try to find the Difference betweed @lastModifiedDate of Workflow and Current date

Avatar

Avatar
Validate 1
Level 2
bhaskarc1289447
Level 2

Likes

5 likes

Total Posts

14 posts

Correct Reply

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

Avatar
Validate 1
Level 2
bhaskarc1289447
Level 2

Likes

5 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
bhaskarc1289447
Level 2

07-01-2021

I have a requirement where I have to determine the difference in time when a particular workflow was last Run and current time (in minutes).

 

I query xtk:workflow schema in a JS activity in a workflow with "where" condition with the workflows Internal name and the fetch its @lastModifiedDate. However, when try to find the difference between the current date and lastModified date ( currentDate - lastModifiedDate) it gives NaN error. I tried converting the dates into milliseconds using parse() method. In this case current date gets converted to milliseconds but lastModifiedDate does not and returns NaN. I also tried converting lastModifiedDate into string, generate a date using the string [ var lastDate = new Date(lastModifiedDateString)] and then parse it  , but I get same NaN from lastModifiedDate but current date works fine. The string generated for lastModified is perfectly ok.

 

Please suggest how to get the time difference, in Javascript activity, between the last time the wkf had run and current time. (if possible in minutes) 

Adobe Campaign Classic date and time field workflow activity

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

960 likes

Total Posts

1,090 posts

Correct Reply

509 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,090 posts

Correct Reply

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

07-01-2021

Hi,

 

Use NL.XTK.parseDateTime().

 

Thanks,

-Jon

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1000
Employee
Sukrity_Wadhwa
Employee

Likes

143 likes

Total Posts

866 posts

Correct Reply

35 solutions
Top badges earned
Validate 1000
Validate 500
Validate 250
Validate 100
Validate 25
View profile

Avatar
Validate 1000
Employee
Sukrity_Wadhwa
Employee

Likes

143 likes

Total Posts

866 posts

Correct Reply

35 solutions
Top badges earned
Validate 1000
Validate 500
Validate 250
Validate 100
Validate 25
View profile
Sukrity_Wadhwa
Employee

13-01-2021

Hi @bhaskarc1289447,

Were you able to resolve this query with any of the given solutions or do you still need more help here? Do let us know.

Thanks!

Avatar

Avatar
Shape 1
Level 1
vaibhavnindrajog
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Shape 1
View profile

Avatar
Shape 1
Level 1
vaibhavnindrajog
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Shape 1
View profile
vaibhavnindrajog
Level 1

07-01-2021

I think so you need to use the Time functionality instead of currentDate and last Modified date. 

It might be both the currentDate and ModifiedDate are same i.e. of today because of which you might be receiving an error.