Beispiel #1
0
        static void Main(string[] args)
        {
            int day, month, year;

            Console.WriteLine("Enter date 1 (day-month-year) : ");
            string str = Console.ReadLine();

            string[] splitStrArray = str.Split('-');
            day   = Convert.ToInt16(splitStrArray[0]);
            month = Convert.ToInt16(splitStrArray[1]);
            year  = Convert.ToInt16(splitStrArray[2]);
            uDate date1 = new uDate(day, month, year);

            Console.WriteLine("Enter date 2 (day-month-year) : ");
            str           = Console.ReadLine();
            splitStrArray = str.Split('-');
            day           = Convert.ToInt16(splitStrArray[0]);
            month         = Convert.ToInt16(splitStrArray[1]);
            year          = Convert.ToInt16(splitStrArray[2]);
            uDate date2 = new uDate(day, month, year);

            DateFunction obj  = new DateFunction();
            int          days = obj.getDays(date1, date2);

            Console.WriteLine("the total days : ");
            Console.WriteLine(days);
            Console.ReadKey();
        }
Beispiel #2
0
        public void show(uDate obj)
        {
            int day   = obj.getDay();
            int month = obj.getMonth();
            int year  = obj.getYear();

            Console.Write("date :-{0}-{1}-{2} ", day, month, year);
        }
Beispiel #3
0
        public int getDays(uDate date1, uDate date2)
        {
            //date1.show(date1);
            day1   = date1.getDay();
            month1 = date1.getMonth();
            year1  = date1.getYear();
            day2   = date2.getDay();
            month2 = date2.getMonth();
            year2  = date2.getYear();
            day    = GetDifference();

            return(day);
        }