Exemplo n.º 1
0
        public static MiMFa_Date operator -(MiMFa_Date op1, MiMFa_Date op2)
        {
            var op = new MiMFa_Date(op1);

            op.DecreaseWith(op2);
            return(op);
        }
Exemplo n.º 2
0
        public static int GetLengthDay(MiMFa_Date fromThisDate, MiMFa_Date toThisDate)
        {
            int dayi = 0;
            int mc   = 0;

            dayi += Convert.ToInt32((toThisDate.Year - fromThisDate.Year) * 365);
            if (toThisDate.Month > (mc = fromThisDate.Month))
            {
                while (mc < toThisDate.Month)
                {
                    if (mc++ <= 6)
                    {
                        dayi += 31;
                    }
                    else
                    {
                        dayi += 30;
                    }
                }
            }
            else if (toThisDate.Month < (mc = fromThisDate.Month))
            {
                while (mc > toThisDate.Month)
                {
                    if (mc-- <= 7)
                    {
                        dayi -= 31;
                    }
                    else
                    {
                        dayi -= 30;
                    }
                }
            }
            dayi += toThisDate.Day - fromThisDate.Day;
            if (toThisDate.Year > (mc = fromThisDate.Year))
            {
                while (mc < toThisDate.Year)
                {
                    if (fromThisDate.DateTimeStyle.ZoneCalendar.IsLeapYear(mc++))
                    {
                        dayi++;
                    }
                }
            }
            if (toThisDate.Year < (mc = fromThisDate.Year))
            {
                while (mc > toThisDate.Year)
                {
                    if (fromThisDate.DateTimeStyle.ZoneCalendar.IsLeapYear(mc++))
                    {
                        dayi--;
                    }
                }
            }
            return(dayi);
        }
Exemplo n.º 3
0
 public static void Decrease(MiMFa_Date thisDate, params MiMFa_Date[] withThisDates)
 {
     foreach (var item in withThisDates)
     {
         thisDate.Year  -= item._Year;
         thisDate.Month -= item._Month;
         thisDate.Day   -= item._Day;
     }
 }
Exemplo n.º 4
0
        public static MiMFa_Date operator /(MiMFa_Date op1, MiMFa_Date op2)
        {
            var op = new MiMFa_Date(op1);

            op.Year  /= op2.Year;
            op.Month /= op2.Month;
            op.Day   /= op2.Day;
            return(op);
        }
Exemplo n.º 5
0
 public static bool IsSame(MiMFa_Date thisDate, MiMFa_Date withThisDate)
 {
     if (withThisDate._Year == thisDate._Year &&
         withThisDate._Month == thisDate._Month &&
         withThisDate._Day == thisDate._Day)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
        public static int GetMonthNumberDays(MiMFa_Date ThisDate)
        {
            MiMFa_Date md = new MiMFa_Date();

            ThisDate.CopyTo(md);
            md.Month++;
            md.Day = 1;
            md.Day--;
            return(md.Day);
        }
Exemplo n.º 7
0
 public static void CopyTo(MiMFa_Date fromThisDate, MiMFa_Date toThisDate)
 {
     if (toThisDate == null)
     {
         toThisDate = new MiMFa_Date();
     }
     toThisDate._Year         = fromThisDate._Year;
     toThisDate._Month        = fromThisDate._Month;
     toThisDate._Day          = fromThisDate._Day;
     toThisDate.DateTimeStyle = fromThisDate.DateTimeStyle;
 }
Exemplo n.º 8
0
 public static bool IsBetween(MiMFa_Date thisDate, MiMFa_Date fromThisDate, MiMFa_Date toThisDate)
 {
     if (IsSame(thisDate, fromThisDate) ||
         IsSame(thisDate, toThisDate) ||
         (IsNext(thisDate, fromThisDate) &&
          IsBack(thisDate, toThisDate)))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 9
0
        public static MiMFa_Date GetLengthDate(MiMFa_Date ofThisDate, MiMFa_Date toThisDate)
        {
            float      Len  = GetLengthDay(ofThisDate, toThisDate);
            int        h    = (int)Len / 365;
            int        m    = (int)(Len % 365) / 30;
            int        s    = (int)(Len % 365) % 30;
            MiMFa_Date Date = new MiMFa_Date();

            Date._Year  = h;
            Date._Month = m;
            Date._Day   = s;
            return(Date);
        }
Exemplo n.º 10
0
        public static List <MiMFa_Date> GetDateList(MiMFa_Date ofThisDate, int length)
        {
            List <MiMFa_Date> lmd = new List <MiMFa_Date>();
            MiMFa_Date        md  = new MiMFa_Date();

            ofThisDate.CopyTo(md);
            for (int i = 0; i < length; i++)
            {
                MiMFa_Date m = new MiMFa_Date();
                md.CopyTo(m);
                lmd.Add(m);
                md.Day++;
            }
            return(lmd);
        }
Exemplo n.º 11
0
 public static bool IsNext(MiMFa_Date thisDate, MiMFa_Date fromThisDate)
 {
     if (ReferenceEquals(thisDate, null) || ReferenceEquals(fromThisDate, null))
     {
         return(false);
     }
     if (thisDate.Year > fromThisDate.Year)
     {
         return(true);
     }
     if (thisDate.Year == fromThisDate.Year && thisDate.Month > fromThisDate.Month)
     {
         return(true);
     }
     if (thisDate.Year == fromThisDate.Year && thisDate.Month == fromThisDate.Month && thisDate.Day > fromThisDate.Day)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 12
0
 public static string GetDate(MiMFa_Date date)
 {
     return(string.Format("{0:d2}/{1:d2}/{2:d4}", date.Day, date.Month, date.Year));
 }
Exemplo n.º 13
0
 public static int GetLengthYear(MiMFa_Date fromThisDate, MiMFa_Date toThisDate)
 {
     return(Convert.ToInt32(GetLengthDay(fromThisDate, toThisDate) / 365.25F));
 }
Exemplo n.º 14
0
 public void CopyTo(MiMFa_Date thisDate)
 {
     CopyTo(this, thisDate);
 }
Exemplo n.º 15
0
 public MiMFa_Date GetLengthDate(MiMFa_Date toThisDate)
 {
     return(GetLengthDate(this, toThisDate));
 }
Exemplo n.º 16
0
 public List <MiMFa_Date> GetDateList(MiMFa_Date toThisDate)
 {
     return(GetDateList(this, toThisDate));
 }
Exemplo n.º 17
0
 public static List <MiMFa_Date> GetDateList(MiMFa_Date ofThisDate, MiMFa_Date toThisDate)
 {
     return(GetDateList(ofThisDate, ofThisDate.GetLengthDay(toThisDate)));
 }
Exemplo n.º 18
0
 public static string GetMonthName(MiMFa_Date ThisDate, MiMFa_DateTime dateTime)
 {
     return(MiMFa_Convert.ToMonthName(ThisDate, dateTime));
 }
Exemplo n.º 19
0
 public bool IsSame(MiMFa_Date thisDate)
 {
     return(IsSame(this, thisDate));
 }
Exemplo n.º 20
0
 public static DateTime GetDateTime(MiMFa_Date date)
 {
     return(new DateTime(date.Year, date.Month, date.Day));
 }
Exemplo n.º 21
0
 public static string GetDayOfWeekName(MiMFa_Date ThisDate, MiMFa_DateTime dateTime)
 {
     return(MiMFa_Convert.ToDayOfWeekName(ThisDate, dateTime));
 }
Exemplo n.º 22
0
 public int GetLengthDay(MiMFa_Date toThisDate)
 {
     return(GetLengthDay(this, toThisDate));
 }
Exemplo n.º 23
0
 public int GetLengthMonth(MiMFa_Date toThisDate)
 {
     return(GetLengthMonth(this, toThisDate));
 }
Exemplo n.º 24
0
 public bool IsNext(MiMFa_Date fromThisDate)
 {
     return(IsNext(this, fromThisDate));
 }
Exemplo n.º 25
0
 public bool IsBack(MiMFa_Date fromThisDate)
 {
     return(IsBack(this, fromThisDate));
 }
Exemplo n.º 26
0
 public bool IsBetween(MiMFa_Date fromThisDate, MiMFa_Date toThisDate)
 {
     return(IsBetween(this, fromThisDate, toThisDate));
 }
Exemplo n.º 27
0
 public static int GetLengthMonth(MiMFa_Date fromThisDate, MiMFa_Date toThisDate)
 {
     return(Convert.ToInt32(GetLengthDay(fromThisDate, toThisDate) / 30.4375F));
 }
Exemplo n.º 28
0
 public static int GetDayOfWeekNum(MiMFa_Date ThisDate, MiMFa_DateTime dateTime)
 {
     return(MiMFa_Convert.ToDayOfWeekNum(ThisDate, dateTime));
 }
Exemplo n.º 29
0
 public static bool IsLeapYear(MiMFa_Date thisDate)
 {
     return(thisDate.DateTimeStyle.ZoneCalendar.IsLeapYear(thisDate.Year));
 }
Exemplo n.º 30
0
 public void SetDate(MiMFa_Date date)
 {
     SetDate(date.Year, date.Month, date.Day);
 }