Read string from asp textbox and format it to DateTime (C#)
<%@ Page Language="C#" Debug="true"%> <script runat="server"> void Page_Load() { if (Page.IsPostBack) { DateTime MyDateTime; lblDateOut.Text = Convert.ToString(txtDateIn.Text); //reads the variable } } </script> <html> <head> <title>Variables Example - String and Char</title> </head> <body> <form runat="server"> <asp:TextBox runat="server" ID="txtDateIn" ></asp:TextBox><br> <asp:Label runat="server" ID="lblDateOut" >Label</asp:Label><br> <asp:Button runat="server" Text="Click me format date time"></asp:Button> </form> </body> </html>