I use the following code in my Magento 1 store, but I want to convert it to Magento 2. I load this in a custom .phtml file to display on a CMS page.

How can rewrite the following for Magento 2?


<?php $weekday = Mage::getSingleton('core/date')->date('w'); 
$hour = Mage::getSingleton('core/date')->date('G.i');   
$closedDates = array('01-01', '22-04', '30-05', '10-06', '26-07', '25-12', '26-12', '31-12');
$closedDatestime = array('24-12');
$date = Mage::getSingleton('core/date')->date('d-m');?>

Your Answer

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

Browse other questions tagged or ask your own question.