Set Text do DateTime according a specific format

Hi I am new at Outsystems and I'm trying to set a text to datetime in this format: MM-DD-YYYY HH:MM:SS

However this format does not work:

FormatDateTime(TextToDateTime(StatusDate),"MM-DD-YYYY hh:mm:ss")

Heello Marco. You can try this. It works fine on my platform.

If you use "DD-YYYY" in lower case, it will work. I hope it helps you.

Hi Marco,

Just added to what daniel has suggested, you can also check by do hover on function on service studio to get what kind of characters or format that function supports.



Thanks,

Sachin

I am trying to convert as you guys have said, I also created an app to do some tests but I am getting the null date. The app follows attached.

Hi Marco,

As you can see in the above screenshot that I have pasted the 'TextToDateTime() function only supports few valid date string combinations. Since you are taking date something else is breaking for your case and resulting in a null date.

Try date as string from the below options.

Thanks,

Sachin

Hi Marco, 

I did some changes in your OML please refer the attached OML,(Change the format of default value of date for your local variable "TextVariable").

In outsystems the default date is in "yyyy-mm-dd" format and for FormatDateTime() also the input should be in the form of "yyyy-mm-dd" and your are passing date in the format of "dd-mm-yyyy" format thats why you are getting null value all the time.

Hope this will helps you

Regards,

Vipasha

 

Marco Silva wrote:

I am trying to convert as you guys have said, I also created an app to do some tests but I am getting the null date. The app follows attached.

Update date format on service center according to passing yours date.

please check attached screenshot.





 



Hope it will help you.

Vijay M-

So, I am doing this conversion from an upload excel file. I have tried the suggestions but I am still getting the value as null. The OML is attached.

Hi Marco,

Try using Date Time datatype for the receiving structure instead, and make sure on Excel side it's in a recognized DateTime format as well. OS will do the conversion automatically.


Marco Silva wrote:

So, I am doing this conversion from an upload excel file. I have tried the suggestions but I am still getting the value as null. The OML is attached.

 Check your service center once.