I’m extracting a date from the filename and converting it to a specific date format mm-dd-yyyy however after running the job, it seems like the date on filename has different date formats. Is there a way to catch this? Like for two formats I can use the Tryparse date conversion.
Hi
May i know what was the dateformat that we obtain from that filename
can we have a sample filename if possible and the outcome expected as well
Cheers @wonderingnoname
so for this
–assign this filename to a string variable named in_text
–use a assign activity and mention like this out_date_Str = Datetime.ParseExact(Split(Split(in_text,“_”)(2).ToString,“.”)(0).ToString.Trim,“yyyyMMdd”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM_dd_yyyy”)
–now we can concatenate the value of the out_date_Str with a filename like this
Sorry for the delayed response
yah ofcourse it will work on for this format only
to make this robust we need to make sure that the filename has same set of dateformat at the end of the file name
–else we need to form too many probabilities to identify the date format
like this
–ddMMyyyy
–ddMMMyyyy
–MMyyyydd
–MMddyyyy
–MMMddyyyy
–MMddyy
it goes on right…so we need to make it robust with stable dateformat along the filename
which is actually a good practice. Ask the user to create the file with same dateformat at the end or if the process is generating that datetime format then its in our hand to include in our workflow design to handle that
Kindly correct me if i m wrong with the question
Cheers @wonderingnoname