We are leveraging an AJO custom action to integrate our journey with an internal API. This API takes a datetime argument in UTC format as follows: yyyy-MM-ddT HH:mm:ss.SZ (ie. 2023-12-01T23:59:59.000Z).
We are attempting to use the nowWithDelta() function within the request parameters of this custom action. The challenge we are running into is the function returns a datetime more precise than what is accepted by the API. The example below will return a value of 2023-11-14T13:15:58.408771377Z:
nowWithDelta(7, "days", "UTC")
What I'm hoping someone can help with is formatting this datetime to return a datetime with precision at milliseconds. From the example above, that would be 2023-11-14T13:15:58.409Z. Is there a way to do this formatting with functions available in AJO custom action request parameters?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
You can try something like this
toDateTime((substr(toString(nowWithDelta(7, "days", "UTC")), 0, 23)) + 'Z')
@awilsonL1, Can you apply toDateTime conversion function along with nowWithDelta function to get the desired UTC format? Refer to this documentation page.
Views
Replies
Total Likes
Thanks for the response!
This conversion function is one of the things we did explore but the nowWithDelta() function already returns a dateTime object. Thus, if we attempt to pass in the result of that function to the toDateTime() conversion function, it recognizes the input as being invalid for the purpose of conversion. The toDateTime() function is expecting either a string, integer or dateTimeOnly data type for input.
Views
Replies
Total Likes
You can try something like this
toDateTime((substr(toString(nowWithDelta(7, "days", "UTC")), 0, 23)) + 'Z')
Views
Likes
Replies