Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
17 replies
Subscribers
9 subscribers
Views
8658 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
todate function is returning date format in user
saravanarajanj
Certified Senior Developer
over 8 years ago
Hi,
I am using todate() function to convert a text to date value. The function does not take any parameters for dateformat.
the function always returns the date format based on user locale preference only. Is there any alternate approach that I can try, thanks in advance for the suggestions!
OriginalPostID-260360
Discussion posts and replies are publicly visible
0
Sathya Srinivasan
Appian Employee
over 8 years ago
Can you apply DateText() or TEXT() function?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
reginaldm377
over 8 years ago
you can try something like this datetext(todate(now(), "MM-DD-YYYY") OR datetext(now(),"MM-DD-YYYY") (Replace now() with your own value). I think either should work for you.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ram
Certified Lead Developer
over 8 years ago
@Saravanarajan, if you want timezone also to be manipulated at run time, you can apply local() funtion on top of datetext() or text() functions
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saravanarajanj
Certified Senior Developer
over 8 years ago
Thanks for the suggestions. I have tried both datetext and text, it is working fine in expression rule but I need to convert the same back to date and pass it to WriteToDS in process model, the functionality breaks here.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
reginaldm377
over 8 years ago
Try this. 1st line (the 1st conversion) & the 2nd line (saving back into DB) converting that conversion into a date. Adjust code as needed and hope this helps.
with(
local!date:datetext(todate(now()), "DD-MM-YYYY"),
todate(local!date)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saravanarajanj
Certified Senior Developer
over 8 years ago
Thanks reginaldm377. I will try this option
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saravanarajanj
Certified Senior Developer
over 8 years ago
Hi Reginald, I am trying to update it to "MM-DD-YYYY". so the second line todate() is trying to update the text into my user preference. It is throwing an error that month is out of range. Thanks!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
reginaldm377
over 8 years ago
Change the format to the following: "DD-MM-YYYY"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saravanarajanj
Certified Senior Developer
over 8 years ago
Sure, then it returns the result according to the user locale for this as well.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
reginaldm377
over 8 years ago
Does the format have to be in "MM-DD-YYYY"? I want to make sure before I make another suggestion. If not, could you please provide more information?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>