- print_r: documentation ( source)
- ceil: documentation ( source)
<?php
print_r(verifyDate('1.1.2011'));
echo ':::';
print_r(getMonth(null));
echo ':::';
print_r(getQuarter(null));
echo ':::';
print_r(dtf(' '));
function getMonth($d)
{
return dtf($d,'n');
}
function getQuarter($d)
{
return ceil( getMonth($d) / 3);
}
function verifyDate($date)
{
return DateTime::createFromFormat('d.m.Y', $date);
}
function dtf($date, $format = 'd.m.Y'){
if($date){
$date = new DateTime($date);
return $date->format($format);
}
}