Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
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"));
            }
        }
Esempio n. 4
0
        public static string TransferToISO(string datestring, string sourceculture)
        {
            DateTime newdate = X2DateTime.GetCultureDate(datestring, sourceculture);

            if (newdate == DateTime.MinValue)
            {
                return("");
            }
            else
            {
                return(newdate.ToString("yyyyMMddhhmmss"));
            }
        }
Esempio n. 5
0
        public static long TransferToTicks(string datestring, string sourceculture)
        {
            DateTime newdate = X2DateTime.GetCultureDate(datestring, sourceculture);

            if (newdate == DateTime.MinValue)
            {
                return(0);
            }
            else
            {
                return(newdate.Ticks);
            }
        }
Esempio n. 6
0
 public static int GetDayOfWeek()
 {
     return(X2DateTime.GetDayOfWeek(DateTime.Now));
 }