Home >Backend Development >PHP Tutorial >查询日期输出解决办法

查询日期输出解决办法

WBOY
WBOYOriginal
2016-06-13 10:14:10751browse

查询日期输出
从数据库里面查询日期字段‘ndate’得出日期是‘2012-03-25’,现在是要显示日期里面的月份‘03’,怎么样才可以得到‘03’,而且把它变成英文‘march’,但是显示的时候只要‘march’里的前三个字母‘mar’,而且要变成大写‘MAR’,这个应该字母写代码啊?谢谢!

------解决方案--------------------
$s = '2012-03-25';
echo strtoupper(date('M', strtotime($s))); //MAR

------解决方案--------------------

PHP code
$date='2012-03-20';$day=floor((strtotime($date)-time())/3600/24);echo $day>0?"1超出啦'".abs($day)."'天":"2距现在还有'".abs($day)."'天";<br><font color="#e78608">------解决方案--------------------</font><br>$date = '2012-03-20';<br>$day = ceil((strtotime($date)-time())/3600/24);<br>if($day echo "1超出啦'".abs($day)."'天";<br>}else{<br>echo "2距现在还有'".abs($day)."'天";<br><br><br>对于你的应用 ceil 表示不足一天算一天<div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn