ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Convert Date format from MMddyyyy to dd-MM-yyyy using C# and VB.Net in ASP.Net<p>Hi <a class="username" rel="JanviDarji"> JanviDarji</a>,</p> <p>Refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&lt;asp:Label id=&#34;lblMessage&#34; runat=&#34;server&#34; /&gt;</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Globalization; </pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Globalization</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { DateTime mmddyyy = Convert.ToDateTime(DateTime.ParseExact(&#34;11222019&#34;, &#34;MMddyyyy&#34;, CultureInfo.InvariantCulture)); string dateddMMyyyy = mmddyyy.ToString(&#34;dd-MM-yyyy&#34;); lblMessage.Text = dateddMMyyyy; } }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If Not Me.IsPostBack Then Dim mmddyyy As DateTime = Convert.ToDateTime(DateTime.ParseExact(&#34;11222019&#34;, &#34;MMddyyyy&#34;, CultureInfo.InvariantCulture)) Dim dateddMMyyyy As String = mmddyyy.ToString(&#34;dd-MM-yyyy&#34;) lblMessage.Text = dateddMMyyyy End If End Sub</pre> <p><span style="text-decoration: underline;"><strong>Output</strong></span></p> <div><span id="lblMessage">22-11-2019</span></div>https://www.aspforums.net:443/Threads/190631/Convert-Date-format-from-MMddyyyy-to-dd-MM-yyyy-using-C-and-VBNet-in-ASPNet/https://www.aspforums.net:443/Threads/190631/Convert-Date-format-from-MMddyyyy-to-dd-MM-yyyy-using-C-and-VBNet-in-ASPNet/Tue, 13 Aug 2019 05:00:33 GMT