Hi again
I thought I had this sorted until I realised the date I needed to convert was 91202 (YmmDD). Also, when specifying the format, I have no idea the relevance of the lower-case/capitalisation of the letters (YmD etc?)
Any help appreciated.
private static string ConvertDT(string date, string informat, string outformat)
{
DateTime convertedDate;
if (!DateTime.TryParseExact(date, informat, new CultureInfo("en-GB"), DateTimeStyles.None, out convertedDate))
throw new FormatException(string.Format("Unable to format date:{0}", date));
return convertedDate.ToString(outformat);
}
String convertedDate = ConvertDT(“91201” "yMMdd", "yy/MM/dd"); // 01 December 2009