String was not recognized as a valid DateTime dd/mm/yy

Hi, I have attained the string “27/07/20” from a pdf and would like to put that int excel to subtract some days from it, but i found out that in the excel it is not detecting this format. So i decided to change it to a date time date, but i realized that this string could not be recognize as a date time format. Is there any simple solution for this?

@eric_wai

You can refer my below post

Mark as solution if this helps

Thanks

@ksrinu070184
thank you for the reply, but the data ive attained already has the slashes and the solution that you posted seem to be for when the string doesnt have the slashes. Thank you anyways. Maybe i can remove the slashes and use your method instead or maybe you have a better suggestion.

@eric_wai

Can you share your sample string so that i can check and get back to you

Thanks

“27/07/20” this was the sting that i got. thank you :slight_smile:

im also currently using the CDate(date_variable).Tostring(“dd/MM/yyyy”) method

@eric_wai

You can try as below

  1. sample = sample.Replace("/")
    2)sample = sample.Substring(2,2) + “/” + sample.Substring(0,2) + “/” + sample.Substring(4,2)
    3)sample = convert.ToDateTime(sample).ToString(“dd/MM/yyyy”)

Mark as solution if this works

Thanks

Hi @eric_wai

Below is the workflow i have made previously for the same issue

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.