6
Contributors
7
Replies
34
Views
1 Year
Discussion Span
Last Post by cereal
2

Date and time output formatting can easily be done with a format string in the query. Check the MySQL online documentation for your version for details: www.mysql.com

1

You may have better luck with storing times in 24 hour format. Then it takes care of itself.

Edited by diafol

0

OK Mr.Diafol, I understood your opinion. Is there any solutions for my problem?
Because, Now changing it into 24 Hrs format is not possible(it has more than 1500 records)

0

AntonyRayan it is possible , just create a new field in the table with the type you like , a batch to copy data appropriately from the old field to the new , and delete the old field (after that you could even rename the new field to have the name the old had)

0

As jkon says. You could run a simple query to convert it too. Why 1500 records should nake any diffrrence. Did you assume you.d have to do it manually?

-1

I have been working with www.essayhelpdeal.co.uk non-SQL databases for more than 20 years. I chose to update my aptitude set and get a MCDBA cert (Microsoft Certified Data Base Analyst), and it took any longer than I suspected to finish the Database Design test. For your situation, I'd propose that you utilize Microsoft Access as the back end. You can manufacture reports and detach records without learning SQL (altho you can see the SQL they create as you go). At that point it turns into a matter of discovering how to trigger Access activities from the web. That is not my range of aptitude.

1

@Antony try:

SELECT * FROM `TABLENAME` ODER BY date_format(str_to_date(`TIME_COLUMN`, '%r'), '%T') ASC;

This will convert the string to a timestamp that MySQL can parse, then use %T to get the order in the 24H format. But, as suggested, it's better to convert the existing rows into the 24H format and then always save in that format, to avoid extra processing. So you could run an update query, just like above:

UPDATE `TABLENAME` SET `TIME_COLUM` = date_format(str_to_date(`TIME_COLUMN`, '%r'), '%T');

Replace TABLENAME and TIME_COLUMN with yours and remember to test on a copy.

Rule is: save always in UTC, save always in the format that the database can parse, then convert for the client.

For more info see:

Bye!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.