Some useful code related to date in Magento :

1/ Get the current time :

$currentTime = date("d.m.Y", Mage::getModel('core/date')->timestamp(time()));

echo $currentTime;

 

2/Get the first day of current month:

$firstDayOfCurrentMonth = date("01.m.Y", Mage::getModel('core/date')->timestamp(time()));

echo $firstDayOfCurrentMonth;

 

3/Get the last day of current month :

$lastDayOfCurrentMonth = date("t.m.Y", Mage::getModel('core/date')->timestamp(time()));

echo $lastDayOfCurrentMonth;

 

4/Get the first day of previous month :

$firstDayOfPrevMonth = date("01.m.Y", Mage::getModel('core/date')->timestamp(strtotime('first day of previous month')));

echo $firstDayOfPrevMonth;

 

5/Get the last day of previous month :

$lastDayOfPrevMonth = date("t.m.Y", Mage::getModel('core/date')->timestamp(strtotime('first day of previous month')));

echo $lastDayOfPrevMonth;