问题
I'm looking for a way to set the month of Zend_Date using a string from the user (could be Jan, January, etc). For example
$month = strftime("%m", strtotime($month));
$date->set($month, Zend_Date::MONTH);
Will get the month 'number', which then can be used to set the Zend_Date month. Is there a way to do that all with Zend_Date?
回答1:
$month = 'January'; // Or 'Jan' or 1 or '1' or '01'
$date->setMonth($month);
来源:https://stackoverflow.com/questions/1545737/set-zend-date-month-using-user-input