Exactly...

That's why Rogers solution is good (and future proof) and my solution is
bad!  

I was illustrating that point by using 2004-02 in the example..

Andrew

-----Original Message-----
From: Pae Choi [mailto:[EMAIL PROTECTED]] 
Sent: 18 November 2002 22:56
To: Andrew Braithwaite; [EMAIL PROTECTED]
Cc: 'Roger Baklund'
Subject: Re: mysql return days in month?


Not all Feb. has 28 days. It depends on whether it is a lunar year or not.
So Some Feb. will have 28 days and some have 29 days.


Pae


----- Original Message -----
From: "Andrew Braithwaite" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "'Roger Baklund'" <[EMAIL PROTECTED]>
Sent: Monday, November 18, 2002 7:52 AM
Subject: RE: mysql return days in month?


> Thanks for solving this all,
>
> I have do something ugly because I only have the yyyy-mm (3rd party 
> DB) which ends up like this:
>
> Mysql> select dayofmonth((concat('2004-02','-01') + interval 1 month) 
> Mysql> -
> interval 1 day);
>
> Urrggg ;)
>
> Still, much more graceful (and more future proof) than what I just 
> came up
> with:
>
> select case when (right('2002-04',2) = '02') then 28 when 
> ('%09%04%06%11%' regexp right('2002-04',2)) then 30 else 31 end as 
> daysinmonth;
>
> lol....
>
> Thanks
>
> Andrew
> Sql,query
>
> * Roger Baklund
> >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);
>
>
>
> ---------------------------------------------------------------------
> 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