Get Your Magento System’s Time

Magento handles time in a pretty different way. Instead of just using the time on the server it automatically converts the time to the selected time zone in Magento’s system.

The way to get the current time is by using the following code:

Mage::getModel('core/date')->timestamp(time());

What this will do is take the timestamp that you get from the time() function and converts it to the timestamp that Magento says what time it is. So you can wrap this function into PHP standard date() function to output in a format you are used to.

Leave a Reply

Your email address will not be published. Required fields are marked *