International formats

Oct 11, 2010 at 8:30 PM

If you use this FormatString property, it uses the regional date time strings for the current user.

private string FormatString
{
get
{
System.Globalization.DateTimeFormatInfo currentInfo = System.Globalization.DateTimeFormatInfo.CurrentInfo;
switch (this.Format)
{
case DateTimePickerFormat.Long:
return currentInfo.LongDatePattern;
case DateTimePickerFormat.Short:
return currentInfo.ShortDatePattern;
case DateTimePickerFormat.Time:
return currentInfo.ShortTimePattern;
case DateTimePickerFormat.Custom:
if (string.IsNullOrEmpty(this.CustomFormat))
return this._defaultFormat;
else
return this.CustomFormat;
default:
return this._defaultFormat;
}
}