rose.baek
(Rose Baek)
March 14, 2022, 7:45pm
1
I brought the date from the European website with Get text. I wanted to bring it as a DateTime type, but an error occurred that the date type was not available, so I brought it as a string type. Then, I tried all the codes below because I wanted to change the string type date to yyyy/MM/dd from dd-MM-yyy, but an error occurred.
DateTime.ParseExact(getEurDate, “dd-MM-yyyy”, CultureInfo.InvariantCulture).ToString(“yyyy/MM/dd”) = error
DateTime.ParseExact(getEurDate, “yyyy/MM/dd”, CultureInfo.InvariantCulture).ToString(“yyyy/MM/dd”) = error
DateTime.ParseExact(getEurDate.ToString, “dd-MM-yyyy”, CultureInfo.InvariantCulture).ToString(“yyyy/MM/dd”) = error
DateTime.ParseExact(getEurDate, “dd-MM-yyyy”, Nothing).ToString(“yyyy/MM/dd”) = error
DateTime.ParseExact(getEuroDate.ToString.Trim,“dd-MM-yyyy”,nothing).ToString(“yyyy/MM/dd”) = error
getEurDate.Trim.ToString(“yyyy/MM/dd”)
CDate(getEurDate).ToString(“yyyy/MM/dd”) = get error
It doesn’t matter what format this data is imported. I must change it to the yyyy/MM/dd string form.
Please help
Thank you
1 Like
lepumin
(José L. Rodríguez)
March 14, 2022, 7:50pm
2
use:
DateTime.ParseExact(getEuroDate.ToString.Trim({" ", vbNewLine, vbCr, vbLf}),“dd-MM-yyyy”,nothing).ToString(“yyyy/MM/dd”)
1 Like
rose.baek
(Rose Baek)
March 14, 2022, 7:52pm
3
still I get same error => String was not recognized as a valid DateTime.
Hi @rose.baek
DateTime.ParseExact(“Date”.ToString,“dd-MM-yyyy”, CultureInfo.InvariantCulture).toString(“yyyy/MM/dd”)
Please Try.
lepumin
(José L. Rodríguez)
March 14, 2022, 7:54pm
5
your variable getEuroDate have spaces and line breaks.
clean it.
rose.baek
(Rose Baek)
March 14, 2022, 7:56pm
6
DateTime.ParseExact(getEurDate.ToString, “dd-MM-yyyy”, CultureInfo.InvariantCulture).ToString(“yyyy/MM/dd”) = same error
Please find the Attached xaml
DateTime.ParseExact(date1.ToString,“dd-MM-yyyy”, CultureInfo.InvariantCulture).toString(“yyyy/MM/dd”)
This code works.
Please check if the mentioned input in your case “dd-MM-yyyy” is what’s the output of your Get text , kindly use a breakpoint after get text activity and check in immediate to confirm the output format.
Thanks.
system
(system)
Closed
March 17, 2022, 8:11pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.