I have a web application, and I have a label that is pulling a date from the db and displaying it. The date should be displayed “7/21/2011” but instead it is displaying as “July, 21 2011 12:00 AM”
I am formatting the string using the following eval statement –
<asp:Label runat="server" ID="lblDate" Text='<%#Eval("dtmAward", "{0:MM/dd/yyyy}")%>' />
What would make this date format in a long text date form, instead of a conventional date? Everywhere else I use that eval statement (with other dates from the db) it formats correctly.
This is just a hunch, but however you’re binding the data, that column being specified as a DateTime type? If it’s just specified as a string, I can imagine it doesn’t get formatted.