Hi,
I have a date field in Form. The selected date i need to pass it to integration service which is a datetime field. For my inputted date to pass i need to convert todatetime to pass into integration. The issue we are seeing is below conversion is appending the timezone to the datetimefield which is not needed.
ActualResult:
todatetime(ri!BGDate)
7/20/2023 12:00 AM GMT+00:00(Date and Time with Timezone)
ExpectedResult:
7/20/2023 12:00 AM (Date and Time)
Kindly suggest.
Discussion posts and replies are publicly visible
The gmt() function might help you.
I returns 7/20/2023 12:00 AM GMT+00:00(Date and Time) expected is 7/20/2023 12:00 AM(Date and Time)
May be i am asking question in an incorrect way. I have a date which needs to be converted into just date and time without any timezone appended to it.
Actual
7/20/2023 12:00 AM GMT+00:00(Date and Time)
Expected
The issue here is, that there is the value and its textual representation on the screen. And these are two different things.
The value itself is defined by the data type, and the visual by a formatting function. By default Appian uses some standard Java functions to do that.
If that is not what you want, change the type and/or the formatting.
I am not just referring to textual representation which we can modify using text() function.However, I need actual datetime returned by the todatetime() function.It should not contain timezone appeneded to it. When we bring data to appian to display we may need to convert to appian equivalent which is appending timezone to our datetime fields , we are ok if it can be reconverted back to exact datetime without appending timezone.
Looking forward for a response regarding date and time without timezone conversion from date and time with timezone.
Is there any actual issue with this? In 13+ years with Appian I never had any problem with this. Where did you get your doubts?
I think what Stefan, is trying to ask, is what does your integration actually consume? If it is in fact an external system, then it is most definitely not going to be an Appian data type.
It's likely just text. If that's the case, formatting your date correctly should be all you need to do.
The external system is a .Net web service rest endpoint which takes a DateTime field.Since, In Appian form we fill just a date we needed to convert to Date and Time in appian to pass to this external integration thats where during conversion its appending timezone GMT+00:00 which gets appended to the field which looks like 2023-07-20T00:00:00Z where Z is a timeZone which we never wanted in our data.
Ideal ask is the appian should pass 7/20/2023 12:00 AM only Date and Time to external system.
If i understood you correctly, You are asking me to format the date using text field as "7/20/2023 12:00 AM" and pass to external system which accepts DateTime field? How to achieve this?
There are no data types in JSON. Everything is a string. So, you can just use the text function to format your date in any way you want.
BTW, looking at the ISO 8601 standard for date formats and the typical way JSON-HTTP APIs are built, IMHO this API should not have an issue with an ISO format.
a!toJson( a!map( value: "some", date: text(now(), "yyyy-mm-dd") & " 12:00 AM" ) )
When i pass as you just wrote into external system input got the error as below. Its expecting Date Time instead of a text.Internally the Rest endpoint of the service will make a call to Soap Endpoint of .Net version which expects a datatype.
I am taking the risk to repeat myself. There is no date/datetime datatype in JSON!
Any date/datetime is transformed into a string. That service then needs to be able to decode that specific format. The internet recommends to use the format defined in ISO 8601.
You will have to discuss with the team developing that service, what format they expect. And you know how to achieve that in Appian.
I understood now. I checked the external system input format and i formatted using text field now its working as expected.
text(now(), "yyyy-mm-dd") & "T07:17:16.652"
Thanks Guys!!!