2
Reply

compare date with today's date

yogita dhingra

yogita dhingra

Oct 5 2009 5:53 AM
5.5k
 string Expdate = ((Label)e.Row.FindControl("lblExpDate")).Text;

            string date;
            date = Convert.ToString(DateTime.Now.ToString("dd/MM/yyyy"));
            if (DateTime.Compare(Convert.ToDateTime(Expdate),Convert.ToDateTime(date)) < 0)
            {
                ((Label)e.Row.FindControl("lblStatus")).Text = "INActive";
            }
  else
            {
                ((Label)e.Row.FindControl("lblStatus")).Text = "Active";
            }

its not comparing can anyone tell me wht da problem with this code

Answers (2)