compare two dates in php

0

I have a date: ($data->fch_fin_prevista) with this format: 2017-11-29T00:00:00.000Z and I transform it in this way to the format I want:

 $data->fch_fin_prevista=date('d/m/Y',strtotime($data->fch_fin_prevista));

To stay like this: 29/11/2017.

What I need is to be able to compare this date with the current date: date(d/m/Y) but only compare the first digit.

    
asked by Lorenzo Martín 28.09.2018 в 12:01
source

1 answer

3

Use time () for the current date instead of date (). Subtract between the two dates.

  $resultado= time() - strtotime($data->fch_fin_prevista);

You'll tell us if you got it.

    
answered by 28.09.2018 / 12:46
source