Wednesday 26 March 2014

date convert and short system date

DateTime todaydate1 =Convert.ToDateTime(drow["Created"]);
                     string  date=todaydate1.ToShortDateString();
                     string dtpresent = DateTime.Now.ToShortDateString();
                     if (dtpresent == date)
                     {
                     }


Compare the date /  Greater than date getting items  


               //Expiry date
                                    DateTime expire1 = Convert.ToDateTime(drow["Expires"]);
                                    string expire2 = expire1.ToShortDateString();

                                    string today_date = DateTime.Now.ToShortDateString();

                //today date

                                    DateTime theDateA = DateTime.Parse(today_date);
                                    DateTime theDateB = DateTime.Parse(expire2);

                                    if (theDateA < theDateB)
                                    {

No comments:

Post a Comment