01-19-2022 03:46 PM
Hi,
I have a scenario where I am trying to increment a date field by 7 days in loop till it reaches another date value. I see data type as date for the field I am working, still while using plusDays(7) function I am getting error. I couldn’t date.parse() as it’s already a date field. I can’t convert to string as I need to add days to the same field in loop. Does anyone know how to overcome this issue? Please advise.
PFA of screenshot from mapper snap.
Regards,
Amar.
01-19-2022 10:01 PM
Hey @amardeep2021,
Try parsing a stringified version of the date, like this:
Date.parse($weekof.toString()).plusDays(7)
01-20-2022 06:01 AM
Thanks Bojan. I am able to use the expression suggested to add 7 days to date value. But it comes up with timestamp as well which I should not have. To remove timestamp I tried slice and substr fucntions both not working because of data type. Do you know how to remove timestamp from this? PFA of screenshot.
Also I want to achieve something like below.
If A <B
A = A + 7 days
Endif
Any tip for the above 2 would be helpful.
Regards,
Amar.
01-20-2022 08:39 AM
If you’re comparing this field with another, than parse the other field as well, do the comparison and use the .toLocaleDateString()
function after, on both fields. That will help you get the date parts only.
Regards,
Bojan
01-20-2022 10:56 AM
Thanks Bojan. This works to trim timestamp.
Do you know how to increment the same date in loop till it reaches a specific date field value? Please let me know if you have any tips.
Regards,
Amar.