Hi,
Can someone know how could I convert this text Apr 5, 2023, 9:28 AM into YYYY-mm-dd hh:mm:ss?
Hi Ruzzel,
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.
However, note that if you need the conversion server side, the above obviously doesn't work. In that case, you'll have to manually parse it. There may be some Forge assets to help you with it, but I didn't search.
Hi Killian,
Thank you I already solve it using also this solution.
Great it worked for you. Happy coding!
hi @Ruzzel John Bisnar
there are not any particular function which support such format we have to use multiple functions to achieve it..
please follow such step
Steps:
Using substr() in-built function, extract the date value
Split the Date text value with / as delimiter, using the String_Split function referenced from Text Extension
Mend the Date text value, from the split function return value in a default date format yyyy-mm-dd
Using the TextToDate() conversion function, convert the text Date value to Date data type value
and you can achieve it by JavaScript too as Kilian Hekhuis answered.
I did the way of Kilian very straight forward.
Thank you
Hello Ruzzel John Bisnar, I believe there isn't a straight forward way of doing that. Basically, my strategy would be:
2. After that, you can use the FormatDateTime() function and change the date format of the date.
Here are some forum posts with more or less the same issue you are facing in functions/format.
Best regards,
Ana
Hello @Ruzzel John Bisnar ,
you can take a look at this post Link : https://www.outsystems.com/forums/discussion/16546/text-to-date-conversion/
I hope it will help you.
Thanks
Vaishnavi Bokade