I have created a rule to display date time
and currently my loacale of my profile is English (united states)I changed it to english (united kingdom) and now it is giving me this errorAny idea why ?how to resolve it ?
Discussion posts and replies are publicly visible
todatetime() expects an input string formatted presumably in your given time zone's format. if you changed your user locale but didn't update the formatting of the string you're passing it, then most likely it's now getting a string that it doesn't understand the formatting for.
I can't give much more specific advice than that since you haven't included your actual code and haven't included the source for the date/time string you're trying to pass into "todatetime()", both of which are important for figuring out what you'd need to change here.
if( rule!P3_utils_checkIsNullOrEmpty(ri!dateTime), {}, text(todatetime(ri!dateTime),cons!QST_FORMAT_DATE_TIME),)cons!QST_FORMAT_DATE_TIME - dd/mmm/yyyy hh:mm zdatetime variable is any type.and the main thing is we are passing date as text. We are fetching it from JSON.
What do you mean with "fetching in from JSON"?
If I do a fromJson() on a correctly formatted datetime JSON value, Appian returns me a dateTime value.
i did a!fromjsonthe value is "9/30/2025 9:30 AM AKDT",i changed the locale of my system. and it was breaking. did you changed the locale ?
Is that the value in the JSON, or the return of fromJson()?
This is a datetime value according to ISO 8601. Any other format is "garbage" and you have to parse it manually.
fromjson
Is this rule expecting to receive a dictionary (which is what you're passing it here), as opposed to a bare DateTime value?
yes it is anytype variable
"9/30/2025 9:30 AM AKDT"here 30 is a daybut based on my locale it is considering as a month. so that's y error is populating.any idea that how can we identify that 1 st part of date is considering day or month on the basis of locale. that can help me to solve the problem
but that's not relevant. you're still passing the entire dictionary returned by a!fromJson(), which would be like
{ dateTime: <datetime value>}(or per Stefan's runtime example above: )
So the issue is: this rule would need to understand that it's looking for a property named "datetime" from the value being fed into it, if you're trying to feed it the entire dictionary. It's crashing because it is not doing this. Otherwise you should be feeding just the ".datetime" property of the a!fromJson() result.