Amol88 Amol88 - 2 years ago 276 Question

How to convert string date (25.04.2016) to date format (mm/dd/yyyy) in

I have string date (25.05.2016) ,i want to convert it into (mm/dd/yyyy) format in
Please suggest solution.

Answer Source

Use ParseExact with the format you need to get the string into a date variable, then .ToString to convert to another format:

Dim dateString As String = "25.05.2016"
Dim dateFormat As String = "dd.MM.yyyy"
Dim dateValue = DateTime.ParseExact(dateString, dateFormat, CultureInfo.InvariantCulture)


The list of custom datetime formats can be found here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download