如何在mysql中找出月中的天数 [英] how to find out number of days in month in mysql

查看:192
本文介绍了如何在mysql中找出月中的天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mysql表中有几个日期,使用这些日期我需要找出月中的天数。假设我有2003-02-05它应该返回28.例如

I have several dates in mysql tables, using those dates I need to find out the number of days in the month. Suppose i have 2003-02-05 it should return 28. for example

date                days_in_month
2003-2-3            28


推荐答案

SELECT DAY(LAST_DAY(yourdate))

这篇关于如何在mysql中找出月中的天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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