Basic Date Picker Documentation

BasicDatePicker.DateFormat Property

Gets or sets the custom date format. Uses .NET DateTime format specifiers. "d" = ShortDate. "D" = LongDate. (d = day, M = Month, y = Year).

[Visual Basic]
Public Property DateFormat As String
[C#]
public string DateFormat {get; set;}

Property Value

A string value using .NET DateTime syntax format specifiers. Default value = "d" (ShortDate).

Example

Using the DateFormatproperty provides a great deal of flexibility on how to display dates. Examples include: You could also display the date format in the TextBox when the control first loads to provide a 'hint' to users of the required format. Example:

[CS]
BasicDatePicker1.DateFormat = "Date: MMM d, yyyy"; //Date: Feb 20, 2005
BasicDatePicker1.DateFormat = "M-d-yy"; //2-20-05
BasicDatePicker1.DateFormat = "MMMM yyyy"; //February 2005
    
[CS]
string myDateFormat = "Date: MMM d, yyyy";
BasicDatePicker1.DateFormat = myDateFormat;
BasicDatePicker1.NullDateText = myDateFormat;
    

See Also

BasicDatePicker Class | BasicFrame.WebControls Namespace | NullDateText