mysql - Order by date time with AM PM -


I want to write a selected query with the order by datetime field. My date field is in the following format

  2014-04-21 05:30 PM 2014-04-21 06:30 am 2014-04-21 10:30 am   
  SELECT SELECT ORDER by STR_TO_DATE (`date_time`, '% h.% I% p')  

You need to save the date using the DATETIME format in the right format, Makes it easy. However, in your case you can do the form by SELECT * ORDER date_format (STR_TO_DATE (`date_time`, '% y-% m-% d% h:% i% p') ., '% Y-% m-% d% H:% i:% s');



Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

c# - Call function from DLL -