Skip to main content
Employee
Dec 12, 2024 5:14 PM UTC
Solved

Issue with datetext() conversion

Can someone explain why datetext() is returning 2022-11-30 given the input of the date 12/1/2022. 

I came across this thread which states datetext() is no longer supported however it appears within the latest (24.4) All Functions list within Appian. community.appian.com/.../issue-with-using-datetext-function-in-appian-portals

mikes0011
mikes0011Answer
Brainy
Dec 12, 2024 5:53 PM UTC
datetext() is returning 2022-11-30 given the input of the date 12/1/2022

As noted in Mathieu's link, wrap the date in gmt().  dateText() is formatting the date value stored in the variable which is "12/1 at 12:00 AM GMT", which in any further-west timezone will resolve as sometime on the evening of 11/30.

The Expression Guru

3 replies

mathieud0001
Genius
Dec 12, 2024 5:40 PM UTC
mikes0011
mikes0011Answer
Brainy
Dec 12, 2024 5:53 PM UTC
datetext() is returning 2022-11-30 given the input of the date 12/1/2022

As noted in Mathieu's link, wrap the date in gmt().  dateText() is formatting the date value stored in the variable which is "12/1 at 12:00 AM GMT", which in any further-west timezone will resolve as sometime on the evening of 11/30.

The Expression Guru
sandhyab4212
Known Participant
Dec 13, 2024 3:40 AM UTC

Hi [mention:4e6e78c0918f4b098c0d86a3401ca3bc:e9ed411860ed4f2ba0265705b8793d05] 

If we want to convert date into specific format, then you can also use text() function, but if you want to use datetext() then use gmt() function to convert into timezone, then you will get the expected output.

eg: text(
now(),
"yyyy-mm-dd"
)