Live Chat Icon For mobile
Live Chat Icon

How do I bind the DateTime value with a specific format?

Platform: Blazor| Category: Data binding

You can bind a specific format for the DateTime value by using the @bind:format attribute of the INPUT element and assign it with the supported date format string value.

Refer to the following code sample.

<input @bind="Value" @bind:format="@Format" />
    public DateTime Value { get; set; } = DateTime.Now;
    public string Format { get; set; } = "yyyy-MM-dd";

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.