PHP:date函数获取月份的日期 [英] PHP: date function to get month of the date

查看:264
本文介绍了PHP:date函数获取月份的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道日期变量的月份。我是ex vb.net,而在那里做的方式只是 date.Month 。如何在PHP中执行此操作?

I want to be able to figure out the month of date variable. I'm ex vb.net and the way to do it there is just date.Month. How do I do this in PHP?

谢谢,

琼斯

我使用 date_format($ date,m); // 01,02..12

这是我想要的,现在问题是如何将它与一个int进行比较,因为 $ monthnumber = 01 刚刚成为 1

This is what I wanted, question now is how do I compare this to an int since $monthnumber = 01 just becomes 1

推荐答案

请参阅 http://php.net/date

date('M') date('n') date('m') ...

更新


m 一个月的数字表示,前导零 01到12

m Numeric representation of a month, with leading zeros 01 through 12

n 一个月的数字表示,无前导零 1到12

n Numeric representation of a month, without leading zeros 1 through 12

这篇关于PHP:date函数获取月份的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆