How to convert a string of ddMMyyyy into DateTime?

Guys,

I hope get some enlightenment here because I am trying to convert a string (ddMMyyyy) to a datetime but failed.

The string split from a file name (eg: Sp_12112019.eml) I managed to assign the “ 12112019 ” portion into a separate string called str_date, then when I tried to convert it into a dateTime format, I cannot find a way out.

image

Victor

1 Like

Hi,

Can you try the following?

DateTime.ParseExact(str_date,"ddMMyyyy",nothing)

Regards,

3 Likes

@Victor_Victory,

You can convert it using the below code, use An assign activity and place this code in the right side of that activity, declare a string variable and hold the value from the below line of code.

If you want some other output date format, then change this format as you want “dd-MM-yyyy”

DateTime.ParseExact(yourDate, "ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture).Tostring("dd-MM-yyyy")
1 Like

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