How to get current store DateTime in Magento 2

- Magento 2

Magento 2 Development

To get current store DateTime in Magento 2, inject an instance of \Magento\Framework\Stdlib\DateTime\DateTime in your class constructor.

Also, use the following code:

Then, you will get the ability to use the following snippet in your class:

Source (Magento Stackexchange Question) (Marius)

More tips from the Cookbook