Home > Technology > Formatting DateTime inside a GridView

Formatting DateTime inside a GridView

(Another snippet I originally posted to CodeKeep.)

Format a datetime value within a gridview’s boundfield control.  The default shows MM/dd/yyyy hh:mm:ss.  In my case, I didn’t want/need the time portion.  So…

 

 

<asp:BoundField DataField="timestamp" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Date entered" />

 

 

Reference:

http://forums.microsoft.com/hongkong/ShowPost.aspx?PostID=4003043&SiteID=82

Tags: ,
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.