public static string FormateFullDate(string strDate, DateClass fieldDate, bool bIsInHtmlFormat) { string pubdate = strDate; string text = string.Empty; if (pubdate.Length > 0) { text = ApplyStandardFormat(fieldDate, pubdate, bIsInHtmlFormat); } return text; }
/// <summary> /// Formates the date. /// </summary> /// <param name="strDate">The STR date.</param> /// <param name="fieldDate">The field date.</param> /// <param name="bIsInHtmlFormat">if set to <c>true</c> [b is in HTML format].</param> /// <returns></returns> public static string FormateDate(string strDate, DateClass fieldDate, bool bIsInHtmlFormat) { string pubdate = strDate; string text = string.Empty; if (pubdate.Length > 0) { switch (fieldDate.YearFormat) { default: case YearFormats.FourDigits: if (Regex.Match(pubdate, @"\d{4}").Success) { text = Regex.Match(pubdate, @"\d{4}").Value; } break; case YearFormats.TwoDigits: if (Regex.Match(pubdate, @"\d{4}").Success) { text = Regex.Match(pubdate, @"\d{4}").Value.Substring(2, 2); } break; case YearFormats.ApostropheTwoDigits: if (Regex.Match(pubdate, @"\d{4}").Success) { text = "'" + Regex.Match(pubdate, @"\d{4}").Value.Substring(2, 2); } break; } text = ApplyStandardFormat(fieldDate, text, bIsInHtmlFormat); } return text; }