Display date with ToShortDateString()

I have a datetime field in SQL Server that is being pulled into the datareader.  I'm trying to display it like so:

lblEstCompletionDate.Text = dr["EstCompletionDate"].ToShortDateString();

I'm trying all kinds of things and just can't get it to display in a mm/dd/yyyy format.  I'm not sure why the above does not work.  I'm getting:

'object' does not contain a definition for 'ToShortDateString'

What is the propper way to accomplish what I'm trying?  If it's not ToShortDateString, what is it?

Thanks in advance.
russomrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

daniel_ballaCommented:
try a cast.
something like:
((DateTime)dr["EstCompletionDate"]).ToShortDateString();

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Arthur_WoodCommented:
or try this:

lblEstCompletionDate.Text = cDate(dr["EstCompletionDate"]).ToString("mm/dd/yyyy'")

AW
daniel_ballaCommented:
Arthur_Wood,
> or try this:

> lblEstCompletionDate.Text = cDate(dr["EstCompletionDate"]).ToString(<wbr/>"mm/dd/yyy<wbr/>y'")

> AW
by the syntax used in the question, I would assume russomr uses C# not VB so the cDate function wouldn't work.
Besides, russomr you can use ToString method to output a certain date format, but then you should use ToString("MM/dd/yyyy") as if you use lowercase m that will output minutes not month.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.