Hello,
I’m trying to get the difference of the dates using the below code but I’m facing an error.
Error message : String was not recognized as valid DateTime.
Actually this is working perfectly for another bot. Please help. Thank you
(DateTime.ParseExact(DateTime.Now.ToString(“yyyyMMdd”), “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture)-DateTime.ParseExact(PostingDate, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture)).TotalDays
ErrorUipath.docx (120.1 KB)
lakshman
(Ganta lakshman)
February 23, 2022, 12:05pm
2
@Pavan_Patke
Welcome back to our UiPath community.
Can you check once whether PostingDate value in the mentioned format (yyyyMMdd) or not.
Hello Sir, Yes. I just checked and its in the format “yyyyMMdd”.
Ex : 20180501
Gokul001
(Gokul Balaji)
February 23, 2022, 12:11pm
4
Hi @Pavan_Patke
Can you check the PostingDate as @lakshman suggested
(DateTime.ParseExact(DateTime.Now.ToString(“yyyyMMdd”), “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture)-DateTime.ParseExact(“20220222”, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture)).TotalDays
Format of the PostingDate is differ
Posting Date format should be 20220222
Regards
Gokul
lakshman
(Ganta lakshman)
February 23, 2022, 12:11pm
5
@Pavan_Patke
Can you print both the dates separately and check both are in the same format or not. If possible can you please share screenshot of the output here.
Hello Lakshman sir,
I extracted both the dates and I found that there is a new row added into the application and date filed has gone a row down. Hence it was capturing a string instead of specific date.
Thank you for your time.
system
(system)
Closed
February 26, 2022, 12:43pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.