Free NAS Free NAS - 11 months ago 62
jQuery Question

Jquery search date

I try search by date from directory tree.
But date is in file creation date is in filename and I want search between startDate and endDate.

enter image description here


<div class="row">
<div style="float:left; width:17%;">
<input type="text" style="height:37px;" id="startDate" class="form-control" placeholder="DD/MM/YY">
<div style="float:left; width:17%; margin:0 1%;">
<div class="input-group">
<input type="text" style="width:97.71px;" id="endDate" height:37px;" class="form-control" placeholder="DD/MM/YY" />
<span class="input-group-btn">
<button style="padding: 7.5px 12px; left:-1px;" class="btn btn-default" id="DateSearch" type="button"><i class="fa fa-search"></i></button>

Didn't figure out how to do it.
I found some datePickers but I dont want use them and found dataTables.
I want search in my directory tree by file creation date what is in filename.

Answer Source

Split as i mentioned in my Comments to make year-month-date in this format and compare each file date with your from - to range



<p class="date">2013-08-4</p>
<p class="date">2014-09-5</p>
<p class="date">2015-09-5</p>
<p class="date">2016-09-5</p>


    $(function() {
  var from = new Date("2013-09-4").getTime();
  var to = new Date("2014-09-8").getTime();

  $(".date").each(function(index, value) {
    var dates = $(this).text();

    if (from <= new Date(dates).getTime() && to >= new Date(dates).getTime()) {

      $(this).css("color", "blue");





enter image description here


You could do the same in PHP using strtotime($the_date); which gives you minutes