Hello.
I would like to convert from dd-mmm-yy to dd-mm-yyyy
21-AUG-23 to 21-08-2023
Unfortunately I cannot use the formatdatetime function, nor the JavaScript
Hello,
Please find the below link of discussion and the attached OML-:
https://www.outsystems.com/forums/discussion/79903/convert-mmm-yyyy-to-date-time/#Post332170
https://www.outsystems.com/forums/discussion/79903/convert-mmm-yyyy-to-date-time/#Post332166
Hope this will resolve your issue.
Thanks and Regards,
Vibhor Agarwal
Unfortunately I am not able to use JavaScript in Web Traditional
Hi Carolina Silva Figueiredo ,
Assuming the date/time formats are somewhat common, and you only need them client-side, JavaScript can easily convert it for you. To do so, create a Client Function, e.g. MyTextToDateTime, with a Text as input, and a Date Time as output. Inside the Function, add a JavaScript node, with an Input Parameter of type Text, and an output of Date Time, like this:
Then assign the output of the JavaScript node to the output parameter of the Function.
As suggested by @Kilian Hekhuis in this post
https://www.outsystems.com/forums/discussion/87219/change-to-text-date-to-date-format/Thanks
Thanks
Arif .
Hi Carolina,
Just idea, if you said you cannot use javascript in web traditional (btw you should able to), you can use c# code for this, in integration studio.
Something like :
DateTime.Parse(txtVADate.Text.Trim()).ToString("dd-MM-yyyy", CultureInfo.InvariantCulture);
@Carolina Silva Figueiredo Is it only required for display purposes or are you able to convert this data to a format that is easier handled in your logic (now and in future cases)? If so, you could consider creating a new attribute with the value converted to a yyyy-MM-dd format? Of course there are multiple ways to achieve this: sql convert, creating your own logic flow (string split, switches, etc.).
The additional benefit of permanently having a new attribute is that you could easily convert the yyyy-MM-dd format to dd-MMM-yyyy if needed :).
Why are you not capable of using FormatDateTime? This is such a basic function that can be used anywhere in the application I truly wonder why you can't use this.
Because FormatDateTime requires a data type of date and the attribute I receive comes as text
I know the function and its use cases, it allows me to transform a date in any date format. But as I explained before, I do NOT have a date with date data type
But I presume you can create a date from your text based on your example. So why not first create a Date object and display that as you want. You can do this with TextToDateTime or create a custom converter. You will need to do anyhow if you want to transform it.
Edit:
I think the following C# should do the trick for you. You can add this via Integration Studio;
string text = "21-AUG-23"; DateTime date = DateTime.ParseExact(text, "dd-MMM-yy", CultureInfo.InvariantCulture);
It's possible to convert a text to date via convert (https://www.w3schools.com/sql/func_sqlserver_convert.asp) in a query. Style '106' seems to match your use case 'dd mon yyyy' if you replace the hyphen with a space.
Or even easier, a cast:
SELECT CAST('26-FEB-2017' AS datetime);https://www.w3schools.com/sql/trysqlserver.asp?filename=trysql_func_sqlserver_cast3