public static string ConvertDateFormat(string DateValue, DATE_FORMAT Format) { System.DateTime sDate = new System.DateTime(); string DateRet; if (DateValue == string.Empty) { DateValue = "01/01/2000"; } sDate = DateTime.Parse(DateValue); switch (Format) { case DATE_FORMAT.DDMMYYYY: DateRet = sDate.Day.ToString() + "/" + sDate.Month.ToString() + "/" + sDate.Year.ToString(); break; case DATE_FORMAT.YYYYMMDD: DateRet = sDate.Year.ToString() + "-" + sDate.Month.ToString() + "-" + sDate.Day.ToString(); break; default: DateRet = sDate.Year.ToString() + "-" + sDate.Month.ToString() + "-" + sDate.Day.ToString(); break; } return(DateRet); }
public static extern int GetDateFormat(uint Locale, DATE_FORMAT dwFlags, in SYSTEMTIME lpDate, string lpFormat, StringBuilder lpDateStr, int cchDate);
public static extern void ConvertStdTimeToDateFormat(Int32 stdTm, ref DATE_FORMAT dft, bool znFlag = false);
public void ConvertStdTimeToDateFormatEx(Int32 stdTm, ref DATE_FORMAT dft, bool znFlag = false) { ConvertStdTimeToDateFormat(stdTm, ref dft, znFlag); }
get => this.BirthDate?.ToString(DATE_FORMAT, CultureInfo.InvariantCulture.DateTimeFormat);
public static extern int GetDateFormatEx(string lpLocaleName, DATE_FORMAT dwFlags, [In] ref SYSTEMTIME lpDate, [In] string lpFormat, [Out] StringBuilder lpDateStr, int cchDate);