How to fix date format in ASP .NET BoundField (DataFormatString)?

前端 未结 7 1766

I have a dynamic BoundField (for a DetailsView) with the following code:

BoundField bf1 = new BoundField();
bf1.DataField = \"CreateDate\";
bf1.DataFormatStr         


        
7条回答
  •  心在旅途
    2020-12-30 22:03

    You could add dataformatstring="{0:M-dd-yyyy}" attribute to the bound field, like this:

    
    

    source: cant format datetime using dataformatstring

提交回复
热议问题