Incorrect date format from excel

HI,

I am trying to read date from excel inh strinhbg dob which is currently in format yyyy/mm/dd but studio is reading it as mm/dd/yyyy 00:00:00.
I am taking below in string but studio prints blank.
DateTime.ParseExact(dob, “MM/dd/yyyy HH:mm:ss”, System.Globalization.CultureInfo.InvariantCulture).Tostring(“dd/MM/yyyy”). Please suggest.

Hi @rahul_kumar4

Use the expression below!

DateTime.ParseExact(dob.tostring.substring(0,10), “MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture).Tostring(“dd/MM/yyyy”)

Regards

1 Like