.NET Calendar MM/DD to DD/MM

M

Maziar Aflatoun

Hi everyone,

..NET Calendar control treats all dates in the format of MM/DD/YYYY. Is it
possible to change the calendar property to treat date at DD/MM/YYYY?

Thank you
Maz.
 
K

Ken Cox [Microsoft MVP]

Hi Maziar,

You can set the culture for the page to a culture that uses that format
(like Canadian English):

<%@ Page culture="en-CA" Language="vb" AutoEventWireup="false"
Codebehind="calpgculture.aspx.vb" Inherits="p4320work.calpgculture"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>calpgculture</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<asp:calendar id="Calendar1" runat="server"></asp:calendar>
<p>
<asp:label id="Label1" runat="server">Label</asp:label></p>
<p>&nbsp;</p>
</form>
</body>
</html>

Private Sub Calendar1_SelectionChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Label1.Text = Calendar1.SelectedDate.ToShortDateString
End Sub

Ken
Microsoft MVP [ASP.NET]
Toronto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top