Anybody can help me to get date formated with Zend framework
What I do is:
<?php echo new Zend_Date(2010-05-23, false, 'en');?>
Result I get is: May 22, 2010 12:00:00 AM
I what I need is: May 22, 2010
Thanks.
Anybody can help me to get date formated with Zend framework
What I do is:
<?php echo new Zend_Date(2010-05-23, false, 'en');?>
Result I get is: May 22, 2010 12:00:00 AM
I what I need is: May 22, 2010
Thanks.
The date is returned as ISO standard date, unless you specify a format, as mentioned on the Zend Framework documentation on Zend_Data
A much easier solution would be:
<?php echo date("F d, Y", strtotime(new Zend_Date(2010-05-23, false, 'en')));?>
You can use the string formatting options and constants:
// Using the strings for reading the format:
$date = new Zend_Date('2010-05-23', 'yyyy-MM-dd');
// Using the constants for format:
echo $date->toString(Zend_Date::MONTH_NAME." ".Zend_Date::DAY_SHORT.", ".Zend_Date::YEAR);
Only with Zend_Date...
$dateArray = array('year' => 2010, 'month' => 5, 'day' => 23);
$now = new Zend_Date($dateArray);
$date = $now->toString(Zend_Date::MONTH_NAME . ' ' . Zend_Date::DAY . ', ' . Zend_Date::YEAR);