1. Rômulo Sorato
  2. PowerBuilder
  3. Monday, 28 October 2019 12:32 PM UTC

Hello.

I´m trying to convert a string date coming from user input

 

the string is for example "05/2015" in the format "mm/yyyy"

 

and i want to convert to /01/05/2015 in the format "dd//mm/yyyy"

 

ldcompetencia = date(em_competencia.text)

 

But the date conversion is returning me "1900-01-01"

 

How is the correct way to convert the date?

Accepted Answer
Rômulo Sorato Accepted Answer Pending Moderation
  1. Monday, 28 October 2019 13:47 PM UTC
  2. PowerBuilder
  3. # Permalink

I resolved.

 

Just add the date "01/" with string concatenation before convert

string lsday = "01/"
ldcompetencia = date(lsday+em_competencia.text)

Comment
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.