* Andrew Braithwaite
> Can anyone help? I want to know if there is an easy way to return the
> number of days in a month from mysql.
>
> Ideally there would be a function that did the following...
>
> mysql> SELECT DAYSINMONTH('2002-10');
> +-----------------------+
> | DAYINMONTH('2002-10') |
> +-----------------------+
> | 31 |
> +-----------------------+
> 1 row in set (0.00 sec)
>
> But there isn't....
>
> Anyone got any ideas before I go off and do it in perl?
You can start with the first day of the _next_ month, and go 1 day back...:
mysql> select dayofmonth('2002-11-01' - interval 1 day);
+-------------------------------------------+
| dayofmonth('2002-11-01' - interval 1 day) |
+-------------------------------------------+
| 31 |
+-------------------------------------------+
1 row in set (0.01 sec)
--
Roger
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php