在Laravel中显示两个日期之间的每小时结果

时间:2020-07-09 08:38:36

标签: php laravel datetime

我一直在尝试从laravel中的两个日期获取html进度栏百分比的每小时结果

下面的代码仅每24小时显示一次结果

<div class="card bg-white">
        <div class="card-header">
          <div class="row align-items-center">
            <div class="col-8">
              <!-- Surtitle -->
              <h5 class="surtitle text-primary">Activity</h5>
              <!-- Title -->
              <h5 class="h3 mb-0 text-dark">Progress track </h5>
            </div>
          </div>
        </div>
        <div class="card-body">
          <!-- List group -->
          <ul class="list-group list-group-flush list my--3">
          @foreach($profit as $k=>$val)
          @php
          $date1=date_create(date('Y-m-d'));
          $date2=date_create($val->date);
          $date_diff=date_diff($date2, $date1);
          $f=$val->perce_price * $val->coin_perusd * $date_diff->format('%R%a');
          $t=$val->perce_price * $val->coin_perusd * castrotime($val->plan->duration.' '.$val->plan->period);
          @endphp
            <li class="list-group-item px-0">
              <div class="row align-items-center">
                <div class="col">
                  <h5 class="text-dark">{{$val->plan_name}} {{$val->plan->duration.' '.$val->plan->period}}(s)<br>Ref: #{{$val->trx}} @if ($val->status==1)
                      <span class="badge badge-warning">Mining</span>
                    @else
                      <span class="badge badge-success">Completed</span>
                    @endif </h5>
                  
                  <div class="progress progress-xs mb-0">
                      
                    <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="height:20px; width: {{($f*100)/$t}}%;"></div>
                  </div>
                </div>
              </div>
            </li>
            @endforeach
          </ul>
        </div>
      </div>

请帮助我,以便每小时可以在进度条百分比中显示结果

0 个答案:

没有答案