MM/YYYY string to datetime conversion
Application Type
Reactive

Hi All,
I have string which contains MM/yyyy like "10/2021". I want to convert that string into date or datetime and show in expression.

Is there any solution ?
Thanks in advance

Yogesh

Solution

We have skipped this functionality from project so marking this question as resolve.If anyone having solution they can mention here their idea.

mvp_badge
MVP

Hi Yogesh,

can you let us know what are you trying to achieve because in expression you can directly show your string  .

also you can check https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions


or you need to add in you string a date - "10/2021" to "01/10/2021"


Hi Yogesh , You can convert it into Date 

By using Outsystem inbuilt Function

By using substring you can fetch the values and passes it ,  into the parameter of Texttodate function Like Below
This will return date .

We can index out the string as per requirement and passes into this function .

Texttodate("Substr("10/2021",3,7)"+"-"+"Substr("10/2021",0,2)"+"-"+day(CurrDate()))

Hope this helps.

Cheers,

Yogesh S


Hi Yogesh , 

You can use the inbuilt Function in Outsystems 

FormatDateTime(TextToDate(Day(CurrDate())+"/10/2022"),"yyyy-MM-DD")

If you want to convert the string into datetime format. Add the inbuild function TextToDateTime() in this output.

I hope this helps you!

Kind regards,

Aravindh R 

Hello yogesh, 

 take one variable with the date field

 Ex.startdate and Text="10/2021" (assume local text variable)

and assign that


 startdate= 

NewDate(TextToInteger(Substr(Text,3,4)),TextToInteger(Substr(Text,0,2)),Day(CurrDate()))

as already mention above but substring values is not right so I have post in that way 

Thanks and Regards,

Akshay Deshpande

Solution

We have skipped this functionality from project so marking this question as resolve.If anyone having solution they can mention here their idea.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.