07-13-2021 01:50 AM
I am trying to get the current date and convert it to the 1st of the current month of the current year.
The resulting format should be dd/mm/yyyy
SnapLogic doesn’t recognize this expression (even without the Date.parse):
Date.parse(Date.now().withDayOfMonth(1)+“/”+Date.now().getMonth()+“/”+Date.now().getFullYear()),"\ddMMyyyy")
Where am I going wrong with the syntax?
Solved! Go to Solution.
07-13-2021 02:02 AM
Hi @NAl ,
Try this expression
Date.now().withDayOfMonth(1).toLocaleDateTimeString({"format": "dd/MM/yyyy"})
07-13-2021 02:02 AM
Hi @NAl ,
Try this expression
Date.now().withDayOfMonth(1).toLocaleDateTimeString({"format": "dd/MM/yyyy"})
07-13-2021 02:16 AM
Hi @j.angelevski,
SnapLogic doesn’t recognise it. Here is the error message: Call of parse([dateStringOrEpochTimestamp[, format]]) is missing a closing parentheses. Intermediate result is: "NaN""
07-13-2021 02:19 AM
@NAl , I just tried this expression myself in a Mapper and it works as expected. Make sure you copied the expression properly because the error message is telling you that you are missing a closing parentheses.
07-13-2021 02:28 AM
My bad, you’re right. I just saved and validated the pipeline. Looks like it’s accepted it and the output date is the 01/07/2021.
This is a much cleaner and simpler expression than mine!