String yyyyMMdd to date and back to string (ex:20170928)

I am having trouble converting a string that is formatted in the yyyyMMdd to dateFormat then ultimately back to string again to MM/dd/yyyy. I keep getting “Assign: String was not recognized as a valid DateTime.”

How to fix this ?

string :“20170928”

parsing code i used so far

DateTime.ParseExact( stringDate, "yyyy/MM/dd",System.Globalization.CultureInfo.InvariantCulture)
Date.Parse(stringDate)

Both don’t work and give same error

My flow

Hi,

Can you try the following expression?

DateTime.ParseExact( stringDate, "yyyyMMdd",System.Globalization.CultureInfo.InvariantCulture)

image

Regards,

1 Like

thanks man , added the / instead of just yyyyMMdd( used yyyy/MM/dd

1 Like

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