0

I want new date from current date, difference of 30 days.

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

above is not working for me.

0

Try:

<?php
    echo date("Y-m-d h:i:s",strtotime('-30 days'));
?>

This should work...

0
<?php
    $date = new DateTime();
    $date->modify('-1 months');
    $date->setTimezone(new DateTimezone('Europe/Paris'));
    echo $date->format('Y/m/j'); // 2017/08/7 instead of 2017/09/7 
?>
1
  • @Yogita please accept the answer that you find helpful – PЯINCƏ Sep 16 '17 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.