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


How can I get a specific date format? In my case dd/mm/yyyy"

I know that I could convet.toshortdatestring but I need that my variable will be a date not a string

Get Date Format?
CSV Date Filter Issue

@Lucky0906 Is this what you need? I didn’t noticed you didn’t wanted string.



No, I didn’t I need the date type to make a comparison to other date


Your request doesn’t really make sense. A date only has a “format” when it is converted into string. Otherwise it is a date which can already be compared. The only conditions are the cultureinfo settings (i.e. if you try to compare a US date with a UK date they won’t match all the time! :D)

Please send an example .xaml file of what you are trying to do.



Hey @Lucky0906

If i am not assuming wrong here what you wants to achieve then please review the attached sample workflow and let me know :slight_smile:

Approaches can be many, here is the simplest one :slight_smile:

Dateinformatsample.xaml (6.3 KB)

and also you can check out this as well :slight_smile:




You can use this - Convert.ToDateTime(dt.ToString(“dd/MM/yyyy”)), where dt is DateTime variable.



To convert the datetime into a specific format use the below fomatiing:
DateTime.Now.ToString(“yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture)


I am using the data scraper wizard to get table values from a website and put it into a excel file.
My big problem is that UiPath gets the date fields in mm/dd/yyyy format but they are dd/mm/yyyy. How can I fix this? I dont know where to put Convert.ToDateTime(dt.ToString(“dd/MM/yyyy”)) into the data scraper.


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.


Date Format in Excel Reading Activity

Hi! Thank you for the response!

I managed to solve the problem inside the excel with vba, after the data scrapping.

Just to everybody with the same issue:
The big problem was that some dates imported as dd/mm and some as mm/dd. I realized that some of then were imported as text. Starting with this I wrote a macro that treated… used istext also used datevalue in the code.

Thanks again!



Would you mind sharing the vba code you wrote?

I am attempting to keep only the date in a single cell and any code I attempt to write just does not seem to work.

Thank you!


Hi @ksamsondad,
Use below code it will work.
Mention the what specific format of your input and what format you are expecting.





Hi All,
I got a bit problem in here.
I tried couple of codes about and they don’t work well in my case.
the date i scrapping from web like

I tried
it works with the first one.
and when it comes to the second it will not work.
I tried.
however it will not work from the first one.
I also tried

seems work with the first one only.
Any advice.
Many thanks


Hey @hungdo,

In this case you need to use TryParseExact Method allowing the predicted formats as an array.
Refer this link and find the xaml for reference,

Note: You can convert any formats to your desired format.

Dom :slight_smile:


DateTime.ParseExact("1/11/1991", "d/mm/yyyy", CultureInfo.InvariantCulture).ToString("mm/dd/yyyy")



may I ask what dose “System.Globalization.CultureInfo.InvariantCulture” means here?


Hi @Xiaoyu_Wang,

Namespace: System.Globalization

.NET Framework Class Library

CultureInfo.InvariantCulture Property

Refer this one