Hi all,
I am trying to take a date value from a DB(which I am writing in the Expression value below) and once I am inputting it in rule input it is changing my date value(Refer Value field):
Can anyone guide me what I am doing wrong, I need 03/10/22 as an output.
Thank you.
Discussion posts and replies are publicly visible
Use todate("03-10-2022")
Thanks Shalini, but how can we convert "2022-10-03" that is coming from database to "03-10-2022" ?
Hi,
If it's consistent just use
todate( joinarray( reverse( split(ri!date,"-") ), "/" ) )
I guess that the DB column it's string so note that ri!date should be of type text
Is there a specific reason to store a date as a string in the database? Using a date field would avoid all the hassle.
Splitting and then Reversing worked well in this case, thanks Gabriele Camilli
The exact expression `2022-10-03` (note no quotation marks etc) will evaluate as a math operation, i.e. "2022 minus 10 minus 3", and return an integer value, which Appian will try to interpret as a date (and of course will be very wrong).
Note that if your DB columns are set to the "Date" data type, they will be displayed there as YYYY-MM-DD formatting, however this is just the display mode. Appian will actually receive a proper "date" data type when querying the data from the DB, which in Appian will display with the default Appian date formatting. There should be no need (assuming the date is stored in the DB as a date and not as text) to have to play with manually parsing the value back into a Date from a YYYY-MM-DD formatted text string.
No, We are storing the date in database as date type itself. But the date is stored in this format(2022-10-03) in the DB. Appian is automatically fetching it in correct format on Interface. I got confused in the start, although its resolved now. Thank you.
Exactly!
Thank you Mike, I got confused a bit in that in the start.