It's not all that elegant, but how about this:

Mysql> SELECT date_format(date_add('2002-10-01', interval -1 day), "%d");

Basically, take the first day of the month, subtract one and figure out what
the day number is.

  --  Jason


On 11/18/02 9:02 AM, "Andrew Braithwaite" <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> 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?
> 
> Thanks,
> 
> Andrew
> Sql,query
> 
> ---------------------------------------------------------------------
> 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
> 


---------------------------------------------------------------------
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

Reply via email to