Page 1 of 1

How to sort an array by date having datetime as stamp mysql

Posted: Sat Feb 18, 2012 5:49 am
by lovelf

Code: Select all

 array('primary2'=>'1','friends'=>'5KZM3ZWBXO3KR7FYR74GTO096HD3V14GUTRISP4QLE78QPRGK6I3W7F','datetimep'=>'2012-02-17 19:08:42'),
  array('primary2'=>'2','friends'=>'5FTHIR9V0MK2IK1XP7ZUQ09XXPECDUVZI0OPIUURQMF1S0IAKL0390Z','datetimep'=>'2012-02-17 19:08:48')
How to sort an array by date? I have 'datetimep' which holds a datetime stamp in the mysql table, I wonder how to after selecting all from the table sort by date the values on a separate array.

Re: How to sort by date

Posted: Sat Feb 18, 2012 6:26 am
by StathisG
You might find useful one of these answers. Another way is to convert them to timestamps and sort them this way, but why don't you just sort them in your MySQL query?