I am experiencing a problem with date formatting.
I have a variable that extracts the date of issuance of an invoice of thhe XML in the format 08/28/2019 17:27:24.
I need the date to be in ddMMyyyy format 28082019
My variable is a string
I tried it but it didn’t work
DateTime.ParseExact(dhEmi, “ddMMaaaa”, system.Globalization.CultureInfo.InvariantCulture).ToString
If dhEmi = “08/28/2019 17:27:24”
Then to get as “28-08-2019”
Here you go
dhEmi = DateTime.ParseExact(dhEmi.ToString.Trim,”MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”)
Now the value of dhEmi will be “28-08-2019”
thanks for the contribution.
Message: String was not recognized as a valid DateTime.
This error is presented
@KMota You can use this
assign str = "08/28/2019 17:27:24"
assign str = cDate(str).ToString("ddMMyyyy")
Thank you, it worked perfectly
The example below sent by indra worked fine. Pls take a look . Thank you very much for your help sir.
assign str = " 08/28/2019 17:27:24
assign str = cDate(str).ToString(“ddMMyyyy”)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.