Date comparison on Laravel?

Asked

Viewed 851 times

1

I have a list of records and in this table I have a field data_limite:

$planos = $this->plano->whereIn('id',$planos_id)
                      ->orderBy('created_at','desc')
                      ->get();
print($planos);

I’m listing the data from array, I need to get some information that would be the data_limite of this table and compare with the date of the day?

$dateAtual = date("d/m/Y"); 
$dateCriacao = date('d/m/Y', strtotime("+".$dias_liberacao." days",strtotime($data)));

if($dateCriacao <= $dateAtual)
{
    return redirect()->route('listar-atividades')
                     ->with('status', 'A Atividade não esta disponivel parar edição!');;
}
  • I don’t understand your doubt?

  • 1

    Use Carbon to compare dates: http://carbon.nesbot.com/docs/#api-comparison

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.