Date Format Issue


I am facing an issue with the date format conversion. I need to extract the system date (which is in mm/dd/yyyy format) and provide it to the webapplication in dd-MMM-yyyy. The data type has to be DateTime but not String. Appreciate any help on this.



Use Date.ParseExact function for the same

Amit Anand

Hi Amit,

Below is the issue we are facing.

  1. Arguments Used
    prevdate - Datatype is DateTime
    prevdatestr - Datatype is String
    prevdateparse - Datatype is DateTime

2.Workflow design
prevdate = DateTime.Today.AddDays(-1)
prevdatestr = prevdate.ToString(“dd-MMM-yyyy”)
prevdateparse = Date.ParseExact(prevdatestr,“dd-MMM-yyyy”,System.Globalization.DateTimeFormatInfo.InvariantInfo)

3.To check the output: WriteLine

Output we see: 29-JAN-2020

  1. In the web application, which accepts the date only in the format of DD-MMM-YYYY, we tried parsing the date field using the above arguments ‘prevdatestr’ and also tried parsing ‘prevdateparse’

The application is not accepting the date. It is throwing an error “Please enter a valid From date in DD-MMM-YYYY format.”

PS: Even tried with [CultureInfo.InvariantCulture] and [DateTime.ParseExact]---->Even these options doesnt work

Please let me know for any solution for this.


Hi All,

By any chance, has anyone got a solution for the above mentioned issue, regd providing a date in DD-MMM-YYYY format to a web application. The web application is not accepting the date inspite of providing it in DD-MMM-YYYY format.

It is throwing an error “Please enter a valid From date in DD-MMM-YYYY format.”

Thanks and Regards,


Try debugging your process and put break point at step where you are entering value in web application. See what is the value of argument that is going to be enetered in web app and check if it needs more pre-processing.