Can I use format on sqlDateTime object?

  • Thread starter Thread starter mhf
  • Start date Start date
M

mhf

I have a SqlDateTime object, but when I use DataBinder.Eval on it, the
formatting is ignored:

DataBinder.Eval(Container.DataItem, "mySqlDateTimeObj", "{0:d}")

produces output like this: "10/17/2003 12:00:00 am"


Why can't I use format specifiers on SqlDateTime objects??

Thanks to anyone who can shed a little light ....

Marc
 
Hi,

you can use SQL server Convertto return date format as string :

"Select OrderID, CustomerID, Convert(char(12), OrderDate, 107)
from Northwind.Orders"

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Back
Top