Share via


DatePickerFlyout.YearFormat Property

Definition

Gets or sets the display format for the year value.

public:
 property Platform::String ^ YearFormat { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring YearFormat();

void YearFormat(winrt::hstring value);
public string YearFormat { get; set; }
var string = datePickerFlyout.yearFormat;
datePickerFlyout.yearFormat = string;
Public Property YearFormat As String
<DatePickerFlyout YearFormat="formatString"/>

Property Value

String

Platform::String

winrt::hstring

The display format for the year value.

Remarks

Change the format of the year value by setting the YearFormat property.

The string content of the year value is created by a DateTimeFormatter. You inform the DateTimeFormatter how to format the year value by providing a string that is either a format template or a format pattern. Common templates and patterns for year values are listed in the following table.

format patternformat template
`{year.full} | {year.abbreviated} | {year.abbreviated(n)}``year | year.full | year.abbreviated`
`{era.full} | {era.abbreviated} | {era.abbreviated(n)}`n/a

Note

"Era" only applies when the CalendarIdentifier is set to the Japanese calendar. For the Japanese calendar, era is shown in the year picker.

For the complete list of format templates and format patterns, see the Remarks section of the DateTimeFormatter class documentation.

Note

Some date formats should be avoided if the date picker might be displayed in a small area, such as adding the full string value of the day of week. These strings can be long and might be clipped if the DatePicker's width is forced to be small.

Applies to

See also