I need to use the date string in format "YMMd", for example, "20220329" for today.
I am using the datetext function: datetext(today(), "YMMd"), if today() function return "03/29/2022", then the datetext(today(), "YMMd") will return "20200328". what's the issue there? why I cant get "20220329"? what's the good way to archive it?
Discussion posts and replies are publicly visible
sorry the datetext(today(), "YMMd") return "20220328", not "20200328"
Date format should be "yyyyMMdd"
Also be aware of this: community.appian.com/.../kb-1344-datetext-returns-one-day-before-expected-date
today() function returns the current day in Greenwich Mean Time (GMT) so the result may differ from the current day in your local timezone.
Hi, I am using the same code which you are using and i am getting expected result, please see below. I would suggest you check your environment time zone.
FWIW I always seem to have better results using "text()" for these, rather than "datetext()". Also as Princy noted above already, you need to account for GMT conversion - I would suggest trying the same code but with "today()" wrapped in "local()".
Thanks Mike, it's working.
if you run just today(), you got the same date?
yes, i am getting the same result .
thanks, maybe the timezone setting is not correct, but I am ok now with using text() function.
text(today(),"yyyyMMdd") This returns the expected one.
© 2023 Appian. All rights reserved.