Format date within View in ASP.NET Core MVC

前端 未结 9 2175
借酒劲吻你
借酒劲吻你 2020-12-30 09:51

I have problem in regarding with converting the datetime to date using a model.

Model from Class Library

public partial class LoanCo         


        
9条回答
  •  余生分开走
    2020-12-30 10:39

    If when defining in model does not work, you can use inside your view file:

    @String.Format("{0:dd/MM/yyyy}",ViewBag.TerminoDaAvaliacao)
    

    This ViewBag contains a DateTime value. The time disapears with this format definition. It is not necessary to change DateTime by Date inside the Model file definition.

提交回复
热议问题