Easy way to convert datetime (mysql)

  • Thread starter Thread starter Bobby Edward
  • Start date Start date
B

Bobby Edward

In mysql the db stores date/time as this: yyyy-mm-dd

Is there an easy way to convert it to mm/dd/yyyy?

How about if it shows up in a datagrid column?

How about if the time is appended. For example, my sql is this format:
yyyy-mm-dd hh:ss:mm (no AM/PM)
 
Is there an easy way to convert it to mm/dd/yyyy?
Convert it where? In a query, a stored procedure, during presentation on
screen...?

I want to always display the date/time in this format: mm/dd/yyyy hh:mm
AM/PM

But, I always need to store the date/time in the mysql format: yyyy-mm-dd
hh:mm
I am using XSD datasets which have a built insert/update commands.
The DataGrid control has been deprecated in favour of the GridView control
since ASP.NET v2.0 - to format data in GridView controls, use something
like this:

<asp:BoundField DataField="MySqlDataField"
DataFormatString="{0:mm/dd/yyyy}" HtmlEncode="false" />

Thanks. The DataFormatString should work fine.
Also, the data format mm/dd/yyyy is ambiguous - in that format, today's
date would be shown as 11/06/2008 which, to most of the Western world,
would be understood as 11th June 2008, not 6th November 2008.

The requirements are for mm/dd/yyyy. :)
 
Back
Top