How to resolve this Error : Convert date: String was not recognized as a valid DateTime

image

@Monica_Priyadarshini Can you tell me what you are trying to do , and what is the Format of the date present in BirthDates(item) ?

Here, I’m trying convert the string format birthdates into DateTime format.
BirthDates is a dictionary variable whose key is name of person and values is birthdates.
eg- Key- “Iris West” and Value - “13/02/996”

The date format is “dd_mm_yyyy”.
image

Hello @Monica_Priyadarshini,

This should work for you. Note that the assumption is that the date stored in the Dictionary is in the format “dd/MM/yyyy”. If the date format is different you can change it accordingly.

Date.ParseExact(BirthDates(item),"dd/MM/yyyy”,System.Globalization.DateTimeFormatInfo.InvariantInfo)

Hope that helps. Kudos :slight_smile:

Regards,
Nithin

2 Likes

Yes, It worked
Thanks a lot @Nithin_P

1 Like

@Monica_Priyadarshini,

Do mark the reply that helped you the most as the Solution. Help Link.

Regards,
Nithin

2 Likes