As we known we are setting Magento date and time through admin which is configured from the backend (System > Configuration > General > Locale Options > Timezone) for formatting/displaying date/time.
We used in PHP
<?php
$currenttime = time()
echo $date = date(d-m-Y,$currenttime);
?>
We used for magento
<?php
$currenttime = Mage::getModel('core/date')->timestamp();
echo $date = date(d-m-Y,$currenttime);
?>
Display ccurrent date
<?php echo $curent date = Mage::getModel('core/date')->date(d-m-Y); ?>
Predefined date formatting
<?php
$date = '12-12-2012';
Mage::helper('core')->formatDate($date,'medium',fasle);?>
Note: Mage_Core_Helper_Data::format() has following arguments
public function formatDate($date=null, $format='short', $showTime=false)
{
....
}
We used in PHP
<?php
$currenttime = time()
echo $date = date(d-m-Y,$currenttime);
?>
We used for magento
<?php
$currenttime = Mage::getModel('core/date')->timestamp();
echo $date = date(d-m-Y,$currenttime);
?>
Display ccurrent date
<?php echo $curent date = Mage::getModel('core/date')->date(d-m-Y); ?>
Predefined date formatting
<?php
$date = '12-12-2012';
Mage::helper('core')->formatDate($date,'medium',fasle);?>
Note: Mage_Core_Helper_Data::format() has following arguments
public function formatDate($date=null, $format='short', $showTime=false)
{
....
}
No comments:
Post a Comment
Thankyou for your Comments