Convert date format to another

Hi all

Need your expertise. I am trying to fetch date from data table cell which is in “22-Dec-2022” format. I would need to convert this format as ‘12222022’.

Tried to convert the format by using “date.ParseExact(dtQuoteData.Rows.Item(22)(12).ToString, “DDMonYYYY”, system.Globalization.CultureInfo.InvariantCulture).ToString(“MMDDYY”)” but getting exception “Assign: String ‘22-Dec-2022’ was not recognized as a valid DateTime.”

Can someone please help me resolve this error? Thanks!

Hi @Naresh_Upadhyay1
Welcome to UiPath community
Datetime.ParseExact(dtQuoteData.Rows.Item(22)(12).ToString, “dd-MMM-yyyy”, system.Globalization.CultureInfo.InvariantCulture).ToString(“MMddyyyy”)”

1 Like


The expression you used is correct…but the formats are as follows

Input: dd-MMM-yyyy
Output - MMddyyyy

And also verify if you have time also in the variable…generally in excel you might not see but time might be there…if so use hh:mm:ss


Hi @Naresh_Upadhyay1,

Welcome to UiPath Forum

What about this

  1. read excel use “Excel Application Scope”
  2. then convert the date like below







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