Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Dates

Status
Not open for further replies.

kaijanm

Programmer
May 14, 2003
102
US
This should be easy and obvious, but I haven't yet figured it out.

I'm getting data from SQL Server and the dates show up as 1/31/2003 12:00:00 AM. I don't care about the time, I just want to see 1/31/2003.

I tried this, but it doesn't have any effect.
dob = rdrUsers.Item("birth_date")
LBirthDate.Text = dob.Date.ToString

Any advice would be helpful!
Thanks,
Kimberly
 
get your data into a DateTime object

and use ToShortDateString()

Code:
DateTime birthDate = DateTime.Parse("string_from_database")

LBirthDate.Text = birthDate.ToShortDateString()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top