Format date in Boundfield in a Gridview

I have a boudfield in a Gridview that looks like this:
<asp:BoundField DataField="from" HeaderText="Fr&#229;n" SortExpression="from" DataFormatString="{0:D}" />

I would like to display the date 2006-11-01, but now it also oncludes minutes and seconds like, 2006-11-01 00:00:00. I thought I used the short format date but it doesn't work.
peternordbergAsked:
Who is Participating?
 
YZlatConnect With a Mentor Commented:
try DataFormatString="{0:yyyy-MM-dd}"
0
 
YZlatCommented:
also try {0:s} or {0:u}
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
YZlatCommented:
if that won't work, I am afraid you'll have to change the BoundColumn to a TemplateCOlumn
0
 
peternordbergAuthor Commented:
How would it look if I was to change to template field. I can't get any formatting to work for the Boundfield
0
 
peternordbergAuthor Commented:
Hi, I managed to solve it through useing the formatting you provided and set the HTMLEncode=false.

Thanks.
0
All Courses

From novice to tech pro — start learning today.