Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can I use format on sqlDateTime object?

Thread Tools

Can I use format on sqlDateTime object?

Posts: n/a
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 ....


Reply With Quote
Natty Gur
Posts: n/a

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

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SqlDateTime overflow. Must be between 1/1/1753 12:... ADO.NET EntityFramework Deshi ASP .Net 1 11-05-2009 04:26 PM
SQLDateTime Overflow error (ASP.Net 2.0 with SQL Server 2005) Randy Smith ASP .Net 0 04-19-2007 02:54 AM
SqlDateTime overflow. Paperback Writer ASP .Net 1 06-08-2005 08:16 PM
SqlDateTime overflow when running procedure poppy ASP .Net 1 04-25-2005 09:28 AM
Problems converting a string to SQLDateTime damon.f ASP .Net 2 01-09-2004 11:02 AM