How do I format date and time strings in Blazor?

Platform: Blazor| Category: Data binding

The format-value attribute is used to format the DateTime strings. Other formats, like currency or number formats, are currently not available.

 <input @bind="@StartDate" format-value="yyyy-MM-dd" />
    
   @code {
       private DateTime   StartDate { get; set; } = new DateTime(2020, 1, 1);
   }     

Refer to the link format strings to learn more about formatting.

Share with

Related FAQs

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

Please submit your question and answer.