Set Zend_Date Month using User Input

别等时光非礼了梦想. 提交于 2019-12-11 15:32:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!