Hi, again about DateTime method I get to some conclusionns and build a class of my problem that solve the last expired day of some product I get a day od today and number of month when product can used without any problem and the day when product was made
and compare these two days...
i want to here your opinion about this clas and usinf the Datetime method
Thanks Sergey

class Date
    {
        //data memebers
        private DateTime today = DateTime.Now;  // variable for todays data
        private DateTime published=new DateTime(1900,1,1);//variable for date when product made
        private int month;  // the number of month that product can used
        private DateTime ExDay;// the day when product is expired
        //constructors
        public Date(DateTime today, DateTime published, int month)
        {
            this.today = today;
            this.published = published;
            this.month = month;

        }

        //properties
        public DateTime Publish
        {
            get { return published; }
            set
            {
                Console.Write(" enter a date when a product was made in format(yy/mm/dd) :");
                published = value;
            }

        }
        
        public int MonthEx
        {
            get { return month; }
            set
            {
                Console.Write(" Enter a number of month user can used a product :");
                do
                {
                    month = value;
                    if (month <= 0) Console.WriteLine(" Wrong number Please Re-Enter!!");
                } while (month <= 0);
            }
        }
        //Methods
        //function that solve the expired day
        private DateTime Expired()
        {
            ExDay=published.AddDays(month * 30);
            return ExDay;
        }
        //function that solve if it already over the last expired day or not
        public void  Condition()
        {
            int cond = DateTime.Compare(today, ExDay);
            if (cond >= 0) Console.WriteLine(" You can use the product !!!");
            Console.WriteLine(" You can't use the product!!!");
        }

            

        // bool todayEqualsToday = DateTime.Equals(today1, today2);
           // Console.WriteLine(todayEqualsToday);
           // // todayEqualsTomorrow gets false.
           // bool todayEqualsTomorrow = DateTime.Equals(today1, tomorrow);
           // Console.WriteLine(todayEqualsTomorrow);






            //    DateTime today = DateTime.Now;
            //DateTime answer = today.AddDays(1);
            //Console.WriteLine("{0}", answer);


           //  DateTime today1 = 
           //         new System.DateTime(DateTime.Today.Ticks);
           // DateTime today2 = 
           //         new DateTime(DateTime.Today.Ticks);
           //DateTime tomorrow = 
           //         new System.DateTime(
           //                     DateTime.Today.AddDays(1).Ticks);

           // // todayEqualsToday gets true.
           // bool todayEqualsToday = DateTime.Equals(today1, today2);
           // Console.WriteLine(todayEqualsToday);
           // // todayEqualsTomorrow gets false.
           // bool todayEqualsTomorrow = DateTime.Equals(today1, tomorrow);
           // Console.WriteLine(todayEqualsTomorrow);




        
    }

As it wasnt set in coded blocks its harder to read, it also has a lot of commented code, so theres little to comment on.. other than your "console.write" lines dont actually "get" the value.. or display it.. they'll appear as random unwanted lines.

What did you want the comment on? Your english? Your code? are we to guess what you're doing with it?

As it wasnt set in coded blocks its harder to read, it also has a lot of commented code, so theres little to comment on.. other than your "console.write" lines dont actually "get" the value.. or display it.. they'll appear as random unwanted lines.

What did you want the comment on? Your english? Your code? are we to guess what you're doing with it?

my english I know that not so perfect, I already wrote a lot of comments that you already know what i want to do, All i asked is this code wroten in right way or not and if you can suggest other shorter and more understood way

This article has been dead for over six months. Start a new discussion instead.