Easy way to convert datetime (mysql)

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)
 
B

Bobby Edward

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. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top