Hello, I need to test if two dates are the same in PHP (current date vs. last day of the month), both are strings, but I'm not getting the result using the following code:
if(strcmp($ultimo, $hoje) == 0)
echo "<br><br>As duas datas são iguais";
else
echo "<br><br>As duas datas são diferentes";
The calculation for the last business day is as follows:
$mes = 07;
$ano = 2014;
$dias = cal_days_in_month(CAL_GREGORIAN, $mes, $ano);
$ultimo = mktime(0, 0, 0, $mes, $dias, $ano);
$dia = date("j", $ultimo);
$dia_semana = date("w", $ultimo);
if($dia_semana == 0){
$dia--;
$dia--;
}
if($dia_semana == 6)
$dia--;
$ultimo = (string)mktime(0, 0, 0, $mes, $dia, $ano);
To the current date:
$hoje= date("d/m/Y");
Both dates show the 07/31/2014 result, but I'm not getting equal results. If anyone can help.