str_ETADate: 10/13/2022 00:00:00
Need this date format in date_ETADate
I have written date_ETADate = DateTime.ParseExact(str_ETADate,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
and in catch MM/dd/yyyy also use
but receive output is date_ETADate = [01/01/0001 00:00:00]
Require output is 10/13/2022
ppr
(Peter)
February 23, 2023, 4:23pm
2
satish.rathi59:
0/13/2022 00:00:00
satish.rathi59:
“dd/MM/yyyy”,
you swapped day, month part. So it is failling
I have use try catch and in try catch MM/dd/yyyy also use but still fails
waiting for solution if possible
Thank you
ppr
(Peter)
February 23, 2023, 4:57pm
6
as you see that the screenshots are done within immediate panel (UiPath Debugging) we do have the confirmation that code is working
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
so you can use also these panels and check / inspect the values. Maybe you also have to include the time portion into the format. But as showcased above:
ppr:
MM/dd/yyyy HH:mm:ss can be handled with CDate
1 Like
Anil_G
(Anil Gorthi)
February 23, 2023, 5:23pm
7
@satish.rathi59
This is what you need to use
DateTime.ParseExact(str_ETADate,”MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture)
As you have time also yoi have to include in the format…
Then use .ToString(“MM/dd/yyyy") so that you het the required format in string…
By default the datetime variable is stored as date and time
Hope this helps
Cheers
system
(system)
Closed
February 26, 2023, 5:24pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.