locked
About a GridView in ASP.NET with C# - a DateTime - data format RRS feed

  • 問題

  •  

    Hi everyone,

     

    I have a GridView control. in this control I have made some columns. One of them is a column named Date_pers.

    In this column I want to show the date in this format dd/MM/yyyy - For sample if the date is October - 7  - 2008 in my column Date_pers I want to appear 07/10/2008. I put at DataStringFormat {0Big Smile} but it appears 10/07/2008

     

    So how do I set the format date of this column in that mode:    dd / MM / yyyy.

     

    Thank You very much!

    2008年10月15日 上午 08:22

解答

  • You can try to use {0Big Smiled/MM/yyyy} in the DataStringFormat property.

    2008年10月15日 下午 02:09
  • I would recommend you write the above statement as:

     

    Code Snippet

    <asp:BoundField DataField="lastupdate" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Last update" HtmlEncode="False" />

     

     

    2008年10月20日 上午 03:53

所有回覆

  • You can try to use {0Big Smiled/MM/yyyy} in the DataStringFormat property.

    2008年10月15日 下午 02:09
  • I would recommend you write the above statement as:

     

    Code Snippet

    <asp:BoundField DataField="lastupdate" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Last update" HtmlEncode="False" />

     

     

    2008年10月20日 上午 03:53