Skip to main content
A newer version of this page is available. .

DxTimeEdit<T>.Format Property

Specifies the pattern used to format the Time Edit’s value.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue("")]
[Parameter]
public string Format { get; set; }

Property Value

Type Default Description
String String.Empty

The format pattern. If it is not set, the long time format is applied.

Remarks

Use the Format property to format the Time Edit’s value in edit mode when the editor is focused, and use the DisplayFormat property to format the editor’s display value when the editor is not focused. If the DisplayFormat property is not set, the Format is applied in display and edit modes.

See the Standard Date and Time Format Strings and Custom Date and Time Format Strings MSDN articles for more information about supported formats.

The following example demonstrates how to apply the a 12-hour clock format in display mode and the a 24-hour clock format in edit mode:

<DxTimeEdit @bind-Time="@TimeValue"
            Format="HH:mm"
            DisplayFormat="@DisplayFormat"></DxTimeEdit>

@code {
    TimeSpan TimeValue { get; set; } = DateTime.Now.TimeOfDay;
    string DisplayFormat { get; } = string.IsNullOrEmpty(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.AMDesignator) ? "HH:mm" : "h:mm tt";
}

Time Edit Format

Run Demo: Time Edit - Display Format

See Also