Get a date in formart "dd/mm/yyyy"

@Bruno_Luan_Carvalho
It sounds like you said that on the website the dates are in “dd/mm/yyyy” format?
I think you need to treat it normally as a string and just write it in that format to Excel. You can change the default date format that your computer sees by going to Control Panel > Region and Language. Changing that setting will see the day and month in the correct spot.

However, if you don’t want to change your region and use the basic mm/dd format so you want to convert it then you would probably want to correct it line by line with a ForEach, or if you are processing each line one at a time you can do it within that loop.
You can use I believe
row(“Date”) = Date.ParseExact(“dd/mm/yyyy”,row(“Date”).ToString.Trim,System.Globalization.CultureInfo.InvariantCulture).ToString(“mm/dd/yyyy”)

You can also just treat it in reverse and reformat it like
row(“Date”) = CDate(row(“Date”).ToString.Trim).ToString(“dd/mm/yyyy”) which will flip the month to the date spot and date to the month spot

So in summary,
Either change your Default Regional Date Format for the computer or inside a ForEach reformat each date one by one.

There are also alternative ways with LINQ but was trying to be simple.

Regards.

4 Likes