Jump to content

Sort am & pm


phpBeginner06

Recommended Posts

I have a datatable in a web page that sorts in descending order. It sorts first by date (ie 01/06/2007) and then it sorts by time (ie 5:21 pm or 5:21 am). This worked great until I had a date of 01/06/2007 and a time of 5:35 am and a date of 01/06/2007 and a time of 5:23 pm. The datatable sorted the time numbers, but did not sort the "am" and "pm" values.

So looks like this when it is sorted:

[u]First Display[/u]

01/06/2007
5:35 am

[u]Second Display[/u]

01/06/2007
5:23 pm

My question is; does anyone know a way to sort am/pm value of time (ie date, time, timezone desc)?
Link to comment
https://forums.phpfreaks.com/topic/33150-sort-am-pm/
Share on other sites

If I use date/time; my time keeps display "0000-00-00 00:00:00" as the default; even when I clear out the default field (I am using myPHPAdmin). I want it to sort by "date, time, am/pm"; but I also want to be able to display a time on the web page like: 5:35 am or 5:35 pm, not "0000-00-00 00:00:00".

So how can I do this?
Link to comment
https://forums.phpfreaks.com/topic/33150-sort-am-pm/#findComment-154535
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.