Can I use format on sqlDateTime object?

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
 
N

Natty Gur

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
 

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

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top