Hi, I have 2 questions. Can uipath identify date? I have a text file. Can it extract all the dates from the text file by identifying it. My date is in this format: 01 Apr 2018 to 30 Apr 2018
Into something like this

Secondly, Can Uipath count the days for example in 01 Apr 2018 to 30 Apr 2018 there are 30 days.
Thank you xoxo
@sangasangasanga uipath can count number of days between 2 dates, as per my idea it dont recognize date directly in text.
Please, see the following attachment.
_Test.xaml (7.5 KB)
3 Likes
Hi, could you explain more on how uipath does it?
@sangasangasanga Below one give number days, maybe it give one day less.
(newdate-olddate).Days
@sangasangasanga uipath wont recognize date directly.
@Manjuts90 Oh i see, Thank you
@Manjuts90
(dateTwo-dateone).Days.ToString
For the code above, can’t assign it to a variable is it?

I tried changing variable type to string and datetime but did not work.
in the file i’ve attached, there were the following variables:
theDate, firstDate and secondDate as String
dateOne and dateTwo as DateTime
Make sure you didn’t modify any of them.
Also, make sure date2 is String if you’re trying to assign (dateTwo-dateOne).Days.ToString to it.
@Tiberiu_Niculescu In your file it works. However, when I try to add it into my workflow it keep giving error even thought variable type is string
@sangasangasanga can i know datatypes of dateTwo and dateone variables.
@sangasangasanga datatypes of dateTwo and dateone should be datetime not generic
1 Like
Hi, one more question.
For the line below,
01 Apr 2018 to 30 Apr 2018
Sometimes it might be
01Apr 2018 to 30 Apr 2018
or any of the spaces missing due to OCR accuracy.
The code below may not be then as the line may not be recognized as datetime. How can I solve this?
datetime.ParseExact(firstDate,“dd MMM yyyy”, CultureInfo.InvariantCulture)
@sangasangasanga u may need to change the date by inserting space or u have change the format of ParseExact method.
I tried to do this, but I am not sure what if condition I can put
I cannot do it manually as I have about 100 pdf files
@sangasangasanga u have to identify the those lines one or other way using uipath then only u can do anyone those 2 methods.
if ur reading data from pdf use read pdf activity it is much better OCR technique.
1 Like