Saturday 23 March 2013

change date format in magento


$invoiceid = 3;
$invoice = Mage::getModel("sales/order_invoice")->load($invoiceid);
$orderid = $orderdata['increment_id'];
$time = explode(" ",$invoice['created_at']);
$datearr = explode("-",$time[0]);
$month = strpos($datearr[1], "0");
$mnthnub = ($month == 0) ? substr($datearr[1],1):$datearr[1];
$monthName = date("F", mktime(0, 0, 0, $mnthnub, 10));
$etime = date("g:i a", strtotime($time[1]));
$fineldate = $datearr[2].", ".$monthName.", ".$datearr[0].", ".$etime;
$orderid = $orderdata['increment_id'];
$time = explode(" ",$invoice['created_at']);
$datearr = explode("-",$time[0]);
$month = strpos($datearr[1], "0");
$mnthnub = ($month == 0) ? substr($datearr[1],1):$datearr[1];
$monthName = date("F", mktime(0, 0, 0, $mnthnub, 10));
$etime = date("g:i a", strtotime($time[1]));
$fineldate = $datearr[2].", ".$monthName.", ".$datearr[0].", ".$etime;

No comments: