How to get the date part of DateTime

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I use a string sDate to fetch a SmallDateTime field form SQL Server
and the result is :"2005/12/12 ¤W¤È 12:00:00";

How can I get the Date part from the string?
or can I get the Date part from database?
 
maybe you can use a System.DateTime to fetch the SmallDateTime field
from SQL Server en then use dateTime.ToShortDateString() to get a string
with just the Date part

greetz,
Dries

ad schreef:
 
I use a string sDate to fetch a SmallDateTime field form SQL Server
and the result is :"2005/12/12 ¤W¤È 12:00:00";

How can I get the Date part from the string?
or can I get the Date part from database?

sDate = <ADO.NET object>["sDate"].ToString("dd MMM yyyy");
 
either that or you can parse the string from the database into a valid date
time object using the static parse method.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc, Amazon, B&H etc


Forth-coming VSTO.NET
-------------------------------------------------------------------------------
Mark Rae said:
I use a string sDate to fetch a SmallDateTime field form SQL Server
and the result is :"2005/12/12 ¤W¤È 12:00:00";

How can I get the Date part from the string?
or can I get the Date part from database?

sDate = <ADO.NET object>["sDate"].ToString("dd MMM yyyy");
 

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

Back
Top