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;