Blazor

How do I format date and time strings in Blazor?

How do I format date and time strings in Blazor?

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);
   }     

I would suggest you check the below link for better understanding:
https://docs.microsoft.com/en-in/aspnet/core/blazor/components?view=aspnetcore-3.0#data-binding

Sumitra Kumari Shaw

An Engineering graduate who Enjoys building things that live on the internet.