예제 #1
0
        public HashDate Difference(HashDate withDate)
        {
            HashDate diff = new HashDate(this);

            //NOTE: It is very important to calculate the difference in ascending order below.
            //Reversing this causing serious issues in the calculations.

            //Get the difference in seconds.
            diff.decreaseUnit(DateUnit.Second, withDate.Second);

            //Get the difference in minutes.
            diff.decreaseUnit(DateUnit.Minute, withDate.Minute);

            //Get the difference in hours.
            diff.decreaseUnit(DateUnit.Hour, withDate.Hour);

            //Get the difference in days.
            diff.decreaseUnit(DateUnit.Day, withDate.Day);

            //Get the difference in months.
            diff.decreaseUnit(DateUnit.Month, withDate.Month);

            //Get the difference in year.
            diff.decreaseUnit(DateUnit.Year, withDate.Year);

            return(diff);
        }
예제 #2
0
 public HashDate(HashDate copyFrom) : this(copyFrom.Year, copyFrom.Month, copyFrom.Day, copyFrom.Hour, copyFrom.Minute, copyFrom.Second)
 {
 }