Magento

How to Get a Locale Specific Timestamp and Date in Magento

When developing for multiple store locales it becomes important to ensure you are generating events based on the locale of each store.

You can generate locale based timestamp in Magento by using the following

$currentTimestamp = Mage::getModel('core/date')->timestamp(time()); //Converts server timestamp to locale timestamp
echo $date = date('Y-m-d', $currentTimestamp); //Return a formated date

 

Hans-Eirik Hanifl

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

Related Articles

Leave a Reply

Back to top button
Sign up to the E-Commerce Gorilla newsletter for updates & special promotions.
Join Our Newsletter
SUBSCRIBE
We value your privacy and protect your information like our own. Unsubscribe at anytime.