Help On 2 Dates Comparision

Posted by Vijayar under C# on 12/22/2011 | Points: 10 | Views : 789 | Status : [Member] | Replies : 1
HI
I need to compare 2 date time fields and assign value to a field
how to do this
if txtdate1>txtdate2
fee=25
else
fee=10

I select dates using calendar

vijaya


Responses

Posted by: perfectchourasia-9163 on: 12/22/2011 [Member] Starter | Points: 25

Up
0
Down
if (Page.IsPostBack)
{
if (Convert.ToDateTime(txtIn.Text) > Convert.ToDateTime("1/1/2000"))
{
lblOut.Text = "greater then 1/1/2000";
}
else
{
lblOut.Text = "equal or less then 1/1/2000";
}
}


Like this or convert your date into datetime format try to use datetime datatype while creating table it will much more help full

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response