sort date/time
sort date/time
Currently I use a time format I generate with php with a timezone offset:
[code]date('Y-m-d g:i A',strtotime($utc)+$timezone_offset*60*60)[/code]
This gives this example format: 2012-04-07 9:58 AM. Datatables does not sort this well. I'm not married to this format it doesn't really matter to me. What format in my php code can I use that Datatables will sort by default (without having to create a custom sorting plugin)?
[code]date('Y-m-d g:i A',strtotime($utc)+$timezone_offset*60*60)[/code]
This gives this example format: 2012-04-07 9:58 AM. Datatables does not sort this well. I'm not married to this format it doesn't really matter to me. What format in my php code can I use that Datatables will sort by default (without having to create a custom sorting plugin)?
This discussion has been closed.
Replies
[code]date('d M Y H:i:s',strtotime($utc)+$timezone_offset*60*60);[/code]
For any other format you would need to use a sorting plug-in, of which there are a number of various date formats: http://datatables.net/plug-ins/sorting . Or alternatively you could use the technique described in this article: http://datatables.net/blog/Orthogonal_data
Allan