Date/Time Formatted String as a parameter - Not Working

This one should be simple for the experts.
The following relevance works fine in QnA, but I can’t get it to work when using it as the data for a parameter.

parameter "DateTime" = { (format "{{0}-{{1}-{{2}_{{3}-{{4}-{{5}" + year of item 1 of it as string + month of item 1 of it as two digits as string + day_of_month of item 1 of it as two digits as string + two digit hour of  item 0 of it + two digit minute of item 0 of it + two digit second of item 0 of it) of (time (local time zone) of it, date (local time zone) of it) of now }
...

I have tried it with and without the double {{ in the relevance statement. I have also tried " around the relevance statements as well.

Thanks for the help,
Emil

Not tested, but you should have a look at format + date : https://developer.bigfix.com/relevance/reference/format.html#format-plus-date-format

To avoid confusion and ensure the relevance substitution works correctly, it’s better to URL-encode the curly brackets {} in the format string. Otherwise, they may be misinterpreted.

Try the following instead:

parameter "DateTime" = "{ (format "%7B0%7D-%7B1%7D-%7B2%7D_%7B3%7D-%7B4%7D-%7B5%7D" + year of item 1 of it as string + month of item 1 of it as two digits as string + day_of_month of item 1 of it as two digits as string + two digit hour of item 0 of it + two digit minute of item 0 of it + two digit second of item 0 of it) of (time (local time zone) of it, date (local time zone) of it) of now }"

image

HTML URL Encoding Reference

Brilliant. Thanks for the quick answer. Solved.


Emil

1 Like