How to retrieve only the date without the time

I am reading a date from the database. It has the time appended to the date, because that is how it is stored in SQL server. The problem is that I only want the date portion of the string. Not the hour. How do I do this? Here is an example of the string returned.
2008-10-16 00:00:00.000
TextBox Lmcotangentreason = (TextBox)filterAlchoholMonitoring.FindControl("Lmcotangentreason");
            Lmcotangentreason.Text = Client.cotangent.DateOnProgram.Value.ToString();

Open in new window

LVL 2
brgdotnetcontractorAsked:
Who is Participating?
 
RickEpnetCommented:
How about this?
ateTime dt = DateTime.Now;
 
string sDate = dt.ToString("dd/MM/yyyy");
 
 *********or**********
 
using System.Globalization;
 
DateTime dt = DateTime.Now;
 
string sDate = dt.ToString("d", new CultureInfo("en-CA"))

Open in new window

0
 
brgdotnetcontractorAuthor Commented:
Awesome, thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.