What to convert 21-04-2022 to 21-APR-2022

Screenshot 2022-05-30 172052
throwing this error

@Gopikrishna_S Plz share the entire expression which you have used. As per the error you are trying to convert with a wrong syntax. You can refer the below doc.

1 Like


output_date1=DateTime.ParseExact(input_date, “dd-MM-yyyy” , System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MMM/yyyy”)

Try as above

Assign: String was not recognized as a valid DateTime.

input_date is the date which you want to change
output_date1 is the output variable
after conversion just use a message box and check output_date1.Tostring

output_date1=DateTime.ParseExact(input_date, “dd-MM-yyyy” , System.Globalization.CultureInfo.InvariantCulture)

Take of the last part - if you are trying to assign the value to a Date variable.

.ToString(“dd/MMM/yyyy”) - this formats the date to a string using the supplied date format