In Magento 1.x you could get the store date time via
Mage::getModel('core/date')->gmtDate();
What would be the equivalent to this in Magento 2.x?
datemagento2
In Magento 1.x you could get the store date time via
Mage::getModel('core/date')->gmtDate();
What would be the equivalent to this in Magento 2.x?
Best Answer
You need to inject in your class constructor an instance of
\Magento\Framework\Stdlib\DateTime\DateTime
and use that one.Something like this:
Then, you can use in your class this: