Click here to Skip to main content
12,821,670 members (33,420 online)
Click here to Skip to main content


47 bookmarked
Posted 13 May 2005

Date control with support for languages and different date formats

, 31 May 2005
Using .NET's System.Globalization class for retrieving month names in forgein lanaguages, and the DateTimeFormatInfo for keeping your dates the correct way around.
<%@ Register TagPrefix="cc1" Namespace="i386.UI" Assembly="DropDownDateTime" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CodeProjectDemo.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="" name="vs_targetSchema">
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<font face="Verdana" size="-1"><b>German, short month text, output dd/MM/yyyy</b><br>
				<cc1:dropdowndatetime  id="DropDownDateTime2" runat="server" YearsForward="2" YearsBack="10"
					Culture="de-DE" MonthFormat="MMM" ></cc1:dropdowndatetime><br>
				<b>French, output dd-MM-yyyy<asp:label id="Label1" style="Z-INDEX: 102; LEFT: 368px; POSITION: absolute; TOP: 80px" runat="server"></asp:label></b><br>
				<cc1:dropdowndatetime  id="DropDownDateTime1" runat="server" YearsForward="5" YearsBack="60"
					Culture="fr-FR" DateFormat="dd-MM-yyyy" ></cc1:dropdowndatetime><br>
				<b>Spanish, output yyyyMMdd</b><br>
				<cc1:dropdowndatetime  id="DropDownDateTime3" runat="server" YearsForward="2" YearsBack="10"
					Culture="es-ES" DateFormat="yyyyMMdd" Value="19990506"></cc1:dropdowndatetime><br>
				<b>US, output MM/dd/yyyy in Debugmode</b><br>
				<cc1:dropdowndatetime DebugMode="true" id="Dropdowndatetime4" runat="server" YearsForward="2" YearsBack="10"
					Culture="en-gb" DateFormat="MM/dd/yyyy" Value="11/02/2005"></cc1:dropdowndatetime>
				<asp:button id="Button1" runat="server" Text="Show Output"></asp:button>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author
Software Developer (Senior)
Austria Austria
Programmer, Cook, Photographer I guess that's me.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170308.1 | Last Updated 31 May 2005
Article Copyright 2005 by
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid