public static DateTime GetThisWeekEnd() { DateTime date = DateTime.Now; date.AddDays(7 - X2DateTime.GetDayOfWeek()); return(new DateTime(date.Year, date.Month, date.Day, 23, 59, 59)); }
public static DateTime GetThisWeekStart() { DateTime date = DateTime.Now; date.AddDays(0 - X2DateTime.GetDayOfWeek()); return(new DateTime(date.Year, date.Month, date.Day, 0, 0, 0)); }
/// <summary> /// transfer date string to us standard /// </summary> /// <param name="datestring"></param> /// <param name="sourceculture"></param> /// <returns></returns> public static string TransferToUS(string datestring, string sourceculture) { DateTime newdate = X2DateTime.GetCultureDate(datestring, sourceculture); if (newdate == DateTime.MinValue) { return(""); } else { return(X2DateTime.GetCultureString(newdate, "en-US")); } }
public static string TransferToISO(string datestring, string sourceculture) { DateTime newdate = X2DateTime.GetCultureDate(datestring, sourceculture); if (newdate == DateTime.MinValue) { return(""); } else { return(newdate.ToString("yyyyMMddhhmmss")); } }
public static long TransferToTicks(string datestring, string sourceculture) { DateTime newdate = X2DateTime.GetCultureDate(datestring, sourceculture); if (newdate == DateTime.MinValue) { return(0); } else { return(newdate.Ticks); } }
public static int GetDayOfWeek() { return(X2DateTime.GetDayOfWeek(DateTime.Now)); }