Can't format a databound date

C

cmay

I am using asp.net 2.0's gridview to display some data.

My data source is a collection of custom objects.

These objects expose a property which is a date.

When I databind and try to format the date with
DataFormatString="{0:d}", I get no change to the display. I still get
hours/minutes/seconds am/pm in the grid.

If I change my object to return a string instead of a date, then the
format string works like I would expect it to. Is there no way to get
it to format a date object?

I don't want to have to change my strongly typed date property to a
string just for display purposes.

Is there anything I can do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top