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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.