troubleshooting Question

C# ASP.Net date calculation

Avatar of homeshopper
homeshopperFlag for United Kingdom of Great Britain and Northern Ireland asked on
8 Comments1 Solution312 ViewsLast Modified:
Hi Experts, I am using a c# inline code aspx with visual web developer 2005 express edition.
I have a text box to enter a date formated as '23/07/2007' pressing the button validates the date.
I am trying to print out the date entered in the text box to a label.
Example: if I enter 30/08/2007 in the text box and press the button, I want 30/08/2007 to be printed in the label. One more thing, once the above is achieved I want to calculate the number of days since 01/01/1900
to a seperate label. I am awarding 500 points as this is holding up a project I am working on.
Code so far as follows:
<%@ Page Language="C#"%>
<script runat=server>
void Button_Click(Object sender, EventArgs e)
    /// Response.Redirect( "ThankYou.aspx" );
    /// DateTime x =;
    /// string xStr = x.ToString("dd-MM-yyyy");
    /// lblText1.Text = xStr;
<form id="Form1" Runat="Server">
Enter Date in 23/07/2007 format:
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
  Text="Invalid Product Code!"
  Runat="Server" />
<asp:Button ID="Button1"
    <asp:Label ID="lblText1" runat="server" Text=""></asp:Label>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros