使用用户输入设置Zend_Date Month [英] Set Zend_Date Month using User Input
本文介绍了使用用户输入设置Zend_Date Month的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种方法来设置Zend_Date的月份,使用用户的字符串(可能是1月,1月等)。例如
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);
将获取月份号码,然后可以用于设置Zend_Date月份。有没有办法通过Zend_Date来做这些?
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?
推荐答案
$month = 'January'; // Or 'Jan' or 1 or '1' or '01'
$date->setMonth($month);
这篇关于使用用户输入设置Zend_Date Month的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文