Jesse, There are many ways to convert the datetime to its various parts; short date, short time, month, day, year, hour, minute, seconds, etc.
Here is ShortDate (mm/dd/yyyy): <%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "AddedDate")).ToShortDateString() %> Here is ShortTime (hh:mm am/pm): <%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "AddedDate")).ToShortTimeString() %> When you are entering this in the Visual Studio IDE and type the dot (".") for the ToShortDateString() portion, you will see a list of available formats. Hope this helps. Randall Price Secure Enterprise Technology Initiatives Microsoft Implementation Group Virginia Tech Information Technology 1700 Pratt Drive Blacksburg, VA 24060 Email: [EMAIL PROTECTED] Phone: (540) 231-4396 -----Original Message----- From: Jesse [mailto:[EMAIL PROTECTED] Sent: Monday, December 04, 2006 10:44 AM To: Price, Randall Subject: Re: MySQL Date Issues This displays it, but it displays both the date & time. Is there a format string that will display just the date part, and then just the time part? Thanks, Jesse ----- Original Message ----- From: "Price, Randall" <[EMAIL PROTECTED]> To: "Price, Randall" <[EMAIL PROTECTED]>; "Jesse" <[EMAIL PROTECTED]>; "MySQL List" <mysql@lists.mysql.com> Sent: Monday, December 04, 2006 9:39 AM Subject: RE: MySQL Date Issues Jesse, Try the following: <asp:TemplateColumn> <HeaderTemplate><b>Date</b></HeaderTemplate> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, " StartDateTime ", "{0:d}") %> </ItemTemplate> </asp:TemplateColumn> Hope this helps. Randall Price Secure Enterprise Technology Initiatives Microsoft Implementation Group Virginia Tech Information Technology 1700 Pratt Drive Blacksburg, VA 24060 Email: [EMAIL PROTECTED] Phone: (540) 231-4396 -----Original Message----- From: Price, Randall [mailto:[EMAIL PROTECTED] Sent: Friday, December 01, 2006 5:17 PM To: Jesse; MySQL List Subject: RE: MySQL Date Issues Not sure this is your problem, but do you have the "Allow zero datetime" option on your connect string? For example, connectionString="Server=localhost; User ID=some_user; Password=some_password; Database=some_database; Pooling=false; Allow Zero Datetime=true;" Thanks, Randall Price Secure Enterprise Technology Initiatives Microsoft Implementation Group Virginia Tech Information Technology 1700 Pratt Drive Blacksburg, VA 24060 Email: [EMAIL PROTECTED] Phone: (540) 231-4396 -----Original Message----- From: Jesse [mailto:[EMAIL PROTECTED] Sent: Friday, December 01, 2006 4:45 PM To: MySQL List Subject: MySQL Date Issues OK, I'm about to pull my hair out with this one. I know it's simple, but I can't find a way to do this other than switching it to a string and parsing it out manually (something I should have to be forced to do). I've got a simple MySQL Table with a DateTime field in it. I want to display it as separate fields in a DataGrid, so I've got a column like this in there: <asp:TemplateColumn> <HeaderTemplate><b>Date</b></HeaderTemplate> <ItemTemplate> <%# Container.DataItem("StartDateTime") %> </ItemTemplate> </asp:TemplateColumn> It displays a blank. Also, I've got code where the user clicks an Edit link and it brings up the date and time part separately. When I try to run the following code: StartDate.Text = FormatDateTime(RS("StartDateTime"),2) StartTime.Text = FormatDateTime(RS("StartDateTime"),3) I get the error, "Cast from type 'MySqlDateTime' to type 'Date' is not valid.". I change change the above code to this: StartDate.Text = FormatDateTime(RS("StartDateTime").ToString,2) StartTime.Text = FormatDateTime(RS("StartDateTime").ToString,3) and it works... However, what can I do with the DataGrid column above? Thanks, Jesse -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]