date convertion

This code shows how to use date conversion

<%@ Page Language="C#" debug="true"%>
<script runat="server">

void Page_Load()
if (Page.IsPostBack)
if (Convert.ToDateTime(txtIn.Text) > Convert.ToDateTime("1/1/2000"))
lblOut.Text = "greater then 1/1/2000";
lblOut.Text = "equal or less then 1/1/2000";
} //End date compare
} //End if (Page.IsPostBack)
} //End Page_Load()

<head><title>Demonstrate Date Comparison</title></head>
<form runat="server">
Please enter a date before, equal to or after 1/1/2000:<br>
<asp:TextBox runat="server" ID="txtIn"/><br/>
<asp:Button runat="server" Text="Submit"/><br/>
<asp:Label runat="server" ID="lblOut"/><br/>


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: