tags:

views:

219

answers:

1

My MySQL database has a date field in the format:

yyyy-mm-dd

but in ASP .NET this shows as:

9/14/2009 12:00:00 AM

in both the ItemTemplate and EditItemTemplate.

How do I format the field to display properly?

+2  A: 

You can use ToShortDateString() method of DateTime. You also can use something like this:

DateTime dateTimeObject = Convert.ToDateTime("9/14/2009 12:00:00 AM");
dateTimeObject.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
Vadim
Thanks for the info.
John M