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

前端 未结 7 1541

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:19

    Formatting depends on the server's culture setting. If you use en-US culture, you can use Short Date Pattern like {0:d}

    For example, it formats 6/15/2009 1:45:30 to 6/15/2009

    You can check more formats from BoundField.DataFormatString

    0 讨论(0)
提交回复
热议问题