Contact Support
Formatting in .NET MAUI Date Picker (SfDatePicker)
Format is a way to represent the date in a different string format. You can customize the date format using the Format property in PickerDateFormat. The default format is yyyy_MM_dd
.
The different types of formats are:
dd_MM
- Represents the day month in dd/MM format.
dd_MM_yyyy
- Represents the day month year in dd/MM/yyyy format.
dd_MMM_yyyy
- Represents the day month year in dd/MMM/yyyy format.
M_d_yyyy
- Represents the month day year in M/d/yyyy format.
MM_dd_yyyy
- Represents the month day year in MM/dd/yyyy format.
MM_yyyy
- Represents the month year in MM/yyyy format.
MMM_yyyy
- Represents the month year in MMM/yyyy format.
yyyy_MM_dd
- Represents the year month day in yyyy/MM/dd format.
Default
- Represents the day month year in default culture based format.
The following example demonstrates the Date Picker with the custom format PickerDateFormat.MM_dd_yyyy.
<picker:SfDatePicker x:Name="datepicker"
Format="MM_dd_yyyy"/>
SfDatePicker datePicker = new SfDatePicker()
{
Format = PickerDateFormat.MM_dd_yyyy,
};
this.Content = datePicker;