In my data base I have start_date and end_date for my course pack  and I want to show my div in between course of start date and date end date.
In my current course start date and end date have,
start_date = 2019-08-01
end_date   = 2019-09-01 
My code:
<?php
        date_default_timezone_set('Asia/Kolkata');
        $date = date('Y-m-d', time());
foreach ($fetchyotubedetail as $fetchyoutubedetails) :
        $currentData = date_create($fetchyoutubedetails['start_date']);
        $expiryDate1   = date_create($fetchyoutubedetails['end_date']);
        if ($date <= $currentData && $date <=$expiryDate1){
          echo 'hi';
        }else{ 
          ?>
          <?php
          ?>
  <div class="col-lg-4 col-md-4 col-sm-6 " style="position: relative;">
   <iframe id="<?php echo $fetchyoutubedetails['id'];?>"  class="yt_players" width="972" height="284" src="<?php echo $fetchyoutubedetails['video_links']?>?rel=0&wmode=Opaque&enablejsapi=1;showinfo=0;" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture">
   </style> allowfullscreen></iframe>
              <h3 class="category-name"><a href="#">Category:<?php echo $fetchyoutubedetails['course_title'];?></a></h3><!-- /.category-name -->
   <h2 class="entry-title"><a href="<?php echo base_url();?>MainController/detail?id=<?php echo $fetchyoutubedetails['Category']?>" target="_blank"><?php echo $fetchyoutubedetails['video_title'];?></a></h2>
  <span><i class="fa fa-clock-o"></i> <time datetime="PT5M">Cource Duration : <?php echo $fetchyoutubedetails['cource_duration'] ?> Month</time></span>
</div>
     <?php
        }
        ?>
<?php endforeach; ?>
I do not know where I am wrong in my  if ($date <= $currentData && $date <=$expiryDate1) condition.
If my course pack date is in between start and end date then only show my course div other wise show only echo 'hi';