ancy chacko

ancy chacko

  • NA
  • 71
  • 18.4k

HOW TO COMPARE DATE

Jan 19 2015 8:33 AM
i am displayed date without using db...using this code
 
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[1] { new DataColumn("Datess") });
ViewState["Customers"] = dt;
DateTime startDate = new DateTime(2015, 1, 26);
DateTime stopDate = new DateTime(2015, 2, 28);
int interval = 1;
 
for (DateTime dateTime = startDate; dateTime < stopDate; dateTime += TimeSpan.FromDays(interval))
{
dt.Rows.Add(startDate);
startDate = startDate.AddDays(interval);
ViewState["Customers"] = dt;
}
GridView1.DataSource = (DataTable)ViewState["Customers"];
GridView1.DataBind();
o/p is like this....
date
26/1/2015
..
....
27/2/2015
then i want to compare these date with my database table DATE
my database is
date 42 43 47 78
29/1/2015 p p A P
2/2/2015 A P P A
i want to compare these two date and display like this
date 42 43 47 78
26/1/2015
27/1/2015
28/1/2015
29/1/2015 p p A P
30/1/2015
31/1/2015
2/2/2015 A P P A
.....
...
27/2/2015

Answers (3)