.net Calendar

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.
 
J

Juan T. Llibre

If you mean for display purposes,
set the @Page culture directive :

I have the culture for the page
where my calendar lives set to :

<%@ Page Culture="es-DO" %>

It displays in spanish, in my local date format,
even though I'm running an english-language
version of W2K3 Server.

I think that if you set the culture to "en-GB",
you'll get the dates treated as DD/MM/YYYY .

Check for side-effects, though.
( like time formatting or language quirk differences
between GB English and US English )

Please let us know how you do.



Juan T. Llibre
ASP.NET MVP
===========
 
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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top