Getting a date in dd/MM/yyyy format

Hi there, I am new to UiPath and currently handling a project. However, I’m facing date issues. The date seems to be coming with the time and I receive some error saying “43923.721898148149”.

@TOBIAS_TOH_TENG_KIAT
Can You try this
Convert.ToDateTime(dt.ToString(“dd/MM/yyyy”)) , where dt is DateTime variable.

Hi @TOBIAS_TOH_TENG_KIAT,

Try below code
Convert.ToDateTime(row("Date").ToString())
Or excel date format issue use below code
DateTime.FromOADate(row("Date").ToString())

Regards,
Arivu

2 Likes

What format is the datetime extracted?
iif the date is coming with the time e.g. 12/03/2020 11:13:15 , you can convert it to dd/MM/yyyy by assigning the following to a string variable

DateTime.ParseExact(extractedDate,"dd/MM/yyyy hh:mm:ss", Nothing).ToString("dd/MM/yyyy")

@TOBIAS_TOH_TENG_KIAT My comment in your last question of preserve format will resolve your this issue as well

Hello Tobias,
In this video I do a lot of stuff with String and DateTime:

0:35 Examples for Substring functions
4:10 IndexOf and LastIndexOf
5:00 SubString working together IndexOf and LastIndexOf
6:45 Split string by character
8:50 Split string by string
12:00 Lower Case and Upper Case
12:45 Trim
15:05 Compare strings in multiple ways
19:05 Resume of all the String function part
20:05 DateTime to string in multiple ways
23:00 AddDays get DayofWeek
25:40 Convert from String to DateTime
26:20 Compare DateTime

Thanks,
Cristian Negulescu