I am using “dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture. This result has been assigned to a DateTime Variable. EX: Output for the above is like 08/06/2019
I wanted the output to be 08062019. I wanted to remove “/”.
If i remove the “/” its displaying as - String was not recognized as a valid date time. Help needed.
@Robotics - It looks like you’re talking about DateTime.ParseExact in the top portion, is that true? If so, then you need to make sure the “dd/MM/yyyy” is matching the string that you receive . Then, once you have your own datetime, when you want to output that as a string, you change it to the format you want in your output. So you’d say MyDate.ToString(“ddMMyyyy”)
Sir, I hope get some enlightenment from you 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.
your error suggests you are trying to convert a variable called string2 into a datetime. You said the separate date string is called str_date so you should double check that you are converting the correct variable.
The date “12112019” (assuming November 12, 2019 correct me if I am wrong) is in the format “ddMMyyyy” so make sure that is the format you specify in your datetime.ParseExact activity.
If that doesn’t solve the issue, please use a write line activity immediately before the error occurs to display the string and verify it is indeed “12112019” like you are expecting.