Hi makumbi,
Please use CultureInfo class, which represents a specific culture or a specific language in a specific country/region in date and time formatting.
Please refer below sample.
HTML
<table>
<tr>
<td>DateTime1 :</td>
<td><asp:TextBox ID="txtDateTime1" runat="server" /></td>
</tr>
<tr>
<td>DateTime2 :</td>
<td><asp:TextBox ID="txtDateTime2" runat="server" /></td>
</tr>
</table>
Namespaces
C#
using System.Globalization;
VB.Net
Imports System.Globalization
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
DateTime dt1 = DateTime.ParseExact("24/06/1985", "dd/MM/yyyy", CultureInfo.InvariantCulture);
DateTime dt2 = DateTime.Parse("24/01/1992", new CultureInfo("en-GB"));
txtDateTime1.Text = dt1.ToString();
txtDateTime2.Text = dt2.ToString();
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim dt1 As DateTime = DateTime.ParseExact("24/06/1985", "dd/MM/yyyy", CultureInfo.InvariantCulture)
Dim dt2 As DateTime = DateTime.Parse("24/01/1992", New CultureInfo("en-GB"))
txtDateTime1.Text = dt1.ToString()
txtDateTime2.Text = dt2.ToString()
End Sub
Screenshot