String to date Conversion9

After converting the text file the date is coming like “210809”(yearMonthDay), but I need in the format “09-Sep-21” can anyone please guide me to resolve the issue .

Thanks.

@HeartCatcher

Try this.

         CDate("210809").ToString("dd-MMM-yy")
1 Like

Hi,

Try this method. Assign this expression to a string variable,
DateTime.ParseExact(“210809”,“yyMMdd”,system.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MMM-yy”)

@nithyac Thanks verymuch, its working fine.

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