Show product updated date in Magento -


i want show date of last update (not creation date) in magento product page.

<?php echo $_product->getupdatedat();?> working 

but don't want show time — date.

is possible?

ashley's solution should work, may have wrap in strtotime() first

echo date("y-m-d", strtotime($_product->getupdatedat())); 

i recommend using magento's date model time in timezone (it take care of timestamp).

echo mage::getmodel('core/date')->date("y-m-d", $_product->getupdatedat()); 

take @ app/code/core/mage/core/model/date.php

<?php  class mage_core_model_date {     /**      * converts input date date timezone offset      * input date must in gmt timezone      *      * @param  string $format      * @param  int|string $input date in gmt timezone      * @return string      */     public function date($format = null, $input = null)     {         if (is_null($format)) {             $format = 'y-m-d h:i:s';         }          $result = date($format, $this->timestamp($input));         return $result;     }      /**      * converts input date timestamp timezone offset      * input date must in gmt timezone      *      * @param  int|string $input date in gmt timezone      * @return int      */     public function timestamp($input = null)     {         if (is_null($input)) {             $result = $this->gmttimestamp();         } else if (is_numeric($input)) {             $result = $input;         } else {             $result = strtotime($input);         }          $date      = mage::app()->getlocale()->date($result);         $timestamp = $date->get(zend_date::timestamp) + $date->get(zend_date::timezone_secs);          unset($date);         return $timestamp;     } } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -