How to filter date range or between two dates of a timestamp with this format MM/DD/YYYY hh:mm?
How to filter date range or between two dates of a timestamp with this format MM/DD/YYYY hh:mm?
I have a column named Time-in and I want it to filter a date range or between two dates of a timestamp with this format MM/DD/YYYY hh:mm.
For example if I have this field:
December 04 2015 6:32 AM
December 04 2015 6:34 AM
December 04 2015 6:35 AM
December 05 2015 9:04 AM
December 05 2015 9:06 AM
December 05 2015 9:09 AM
December 06 2015 8:04 AM
December 06 2015 8:06 AM
December 06 2015 8:09 AM
and I want to filter from December 04 2015 to December 05 2015, the expected result will result like this:
December 04 2015 6:32 AM
December 04 2015 6:34 AM
December 04 2015 6:35 AM
December 05 2015 9:04 AM
December 05 2015 9:06 AM
December 05 2015 9:09 AM
Here is the code below:
<div id="startfrom">
<label for="from">From</label>
<input type="text" id="from" name="From">
</div>
<div id="endto">
<label for="to">to</label>
<input type="text" id="to" name="To">
</div>
$(function() {
$( "#from" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onClose: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onClose: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
$(document).ready( function () {
var table = $('#myTable').dataTable( { "aoColumnDefs": [ {"bSortable": false, "aTargets": [ 0, 1, 2, 5 ] } ], "aaSorting": [] } );
$.fn.dataTable.moment('MMMM D YYYY HH:mm');
$('select#positions').change( function() { table.fnFilter( $(this).val() ); } );
$('#from').keyup( function() { table.draw(); } );
$('#to').keyup( function() { table.draw(); } );
} );
Thank you
Jason :)
Answers
Please help me.
Thank you
Jason :)
You can try and use my yadcf plugin for that,
See relevant sample pages http://yadcf-showcase.appspot.com/dom_bootstrap_time.html
and http://yadcf-showcase.appspot.com/dom_bootstrap.html note that you must include https://github.com/Eonasdan/bootstrap-datetimepicker in your html page and try and find the right
date_format
You'd need to use a custom plug-in search function or use something like Daniel's excellent YADCF.
Allan