I have a column in excel with JUN-2018, AUG-2018, etc. They are not in a specific format. I need to change the format to dd/mm/yyyy. How can i do that?
Hi @qaz1, if you have the day available, you could do this.
Date.ParseExact(“DateString”, “dd/mm/yyyy”,System.Globalization.DateTimeFormatInfo.InvariantInfo)
Hi ,
JUN-2018, AUG-2018 - you mentioned only month and year … Date?
without mentioning the date how can we able to convert it into dd/mm/yyyy format
so the date would just be 01-06-2018
the day isnt available but it would be defaulted to 01-06-2018
you can use this code to change any format… try this
DateTime.FromOADate(Convert.ToDouble((Dt.rows(0)(16).ToString))).ToString(“dd-MM-yyyy”)
but date should be mentioned… else it throws error.
Hi @qaz1, first you have to append the day to your date string.
DateString = String.Concat(“01-”,“AUG-2018”)
Then you can convert to your desired format.
Date.ParseExact(DateString,“dd-MMM-yyyy”,System.Globalization.DateTimeFormatInfo.InvariantInfo).ToString(“dd/MM/yyyy”)
Hope this helps. Cheers.