Created
March 9, 2017 11:14
-
-
Save BrunoLagoa/a3340847443dfcb713ba7a847b80abfe to your computer and use it in GitHub Desktop.
funcao_soma_hora.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function diasCorridos($code) | |
{ | |
if(!empty($code)){ | |
date_default_timezone_set('America/Sao_Paulo'); | |
$now = Carbon::now()->parse()->format('Y-m-d'); | |
$date = Carbon::parse($code)->format('Y-m-d'); | |
$date1 = Carbon::createFromFormat('Y-m-d', $date); | |
$date2 = Carbon::createFromFormat('Y-m-d', $now); | |
$value = $date2->diffInDays($date1); | |
return $value; | |
}else{ | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment