Skip to main content
removeu 8 caracteres do conteúdo
Fonte Link
Luiz Felipe
  • 36,5mil
  • 10
  • 74
  • 154

Tranquilo basta utilizar a classe date junto com a strtotimestrtotime.

<?php

$P_Dia_Mes_Atual = date("Y-m-01 00:00:00:00");
$U_Dia_Mes_Atual = date("Y-m-t 00:00:00:00");

$P_Dia_Mes_Anterior = date("Y-m-01 00:00:00:00",strtotime("-1 month"));
$U_Dia_Mes_Anterior = date("Y-m-t 00:00:00:00",strtotime("-1 month"));

print $P_Dia_Mes_Atual;
print $U_Dia_Mes_Atual;

print $P_Dia_Mes_Anterior;
print $U_Dia_Mes_Anterior;

$P_Dia_Mes_Atual = date("Y-m-01 00:00:00:00"); $U_Dia_Mes_Atual = date("Y-m-t 00:00:00:00");

$P_Dia_Mes_Anterior = date("Y-m-01 00:00:00:00",strtotime("-1 month")); $U_Dia_Mes_Anterior = date("Y-m-t 00:00:00:00",strtotime("-1 month"));

print $P_Dia_Mes_Atual; print $U_Dia_Mes_Atual;

print $P_Dia_Mes_Anterior; print $U_Dia_Mes_Anterior;

Tranquilo basta utilizar a classe date junto com a strtotime.

<?php

$P_Dia_Mes_Atual = date("Y-m-01 00:00:00:00"); $U_Dia_Mes_Atual = date("Y-m-t 00:00:00:00");

$P_Dia_Mes_Anterior = date("Y-m-01 00:00:00:00",strtotime("-1 month")); $U_Dia_Mes_Anterior = date("Y-m-t 00:00:00:00",strtotime("-1 month"));

print $P_Dia_Mes_Atual; print $U_Dia_Mes_Atual;

print $P_Dia_Mes_Anterior; print $U_Dia_Mes_Anterior;

Tranquilo basta utilizar a classe date junto com a strtotime.

<?php

$P_Dia_Mes_Atual = date("Y-m-01 00:00:00:00");
$U_Dia_Mes_Atual = date("Y-m-t 00:00:00:00");

$P_Dia_Mes_Anterior = date("Y-m-01 00:00:00:00",strtotime("-1 month"));
$U_Dia_Mes_Anterior = date("Y-m-t 00:00:00:00",strtotime("-1 month"));

print $P_Dia_Mes_Atual;
print $U_Dia_Mes_Atual;

print $P_Dia_Mes_Anterior;
print $U_Dia_Mes_Anterior;
Fonte Link

Tranquilo basta utilizar a classe date junto com a strtotime.

<?php

$P_Dia_Mes_Atual = date("Y-m-01 00:00:00:00"); $U_Dia_Mes_Atual = date("Y-m-t 00:00:00:00");

$P_Dia_Mes_Anterior = date("Y-m-01 00:00:00:00",strtotime("-1 month")); $U_Dia_Mes_Anterior = date("Y-m-t 00:00:00:00",strtotime("-1 month"));

print $P_Dia_Mes_Atual; print $U_Dia_Mes_Atual;

print $P_Dia_Mes_Anterior; print $U_Dia_Mes_Anterior;