2
Answers

compare date with today's date

yogita dhingra

yogita dhingra

15y
5.5k
1
 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)