List:General Discussion« Previous MessageNext Message »
From:Rob Wultsch Date:October 17 2008 8:47pm
Subject:Re: FLOOR(DATE_ADD(CURDATE(), INTERVAL 4 MONTH)) -- ?
View as plain text  
On Fri, Oct 17, 2008 at 1:33 PM, Rene Fournier <m5@stripped> wrote:

> Okay, I realize that query won't work, but that's essentially want I want
> to do:
>
> Add four months to the current date, then return the first day of that
> month, e.g.:
>
>        floor ( 2008-10-16 + 4 months ) = 2009-02-1
>
> Is there a nice SQL way of achieving this?
>
> ...Rene
>

SELECT date(now() + INTERVAL 4 MONTH - INTERVAL day(now())-1 DAY);

-- 
Rob Wultsch

Thread
FLOOR(DATE_ADD(CURDATE(), INTERVAL 4 MONTH)) -- ?Rene Fournier17 Oct
  • Re: FLOOR(DATE_ADD(CURDATE(), INTERVAL 4 MONTH)) -- ?Rob Wultsch17 Oct
    • Re: FLOOR(DATE_ADD(CURDATE(), INTERVAL 4 MONTH)) -- ?Ian Christian17 Oct
      • Re: FLOOR(DATE_ADD(CURDATE(), INTERVAL 4 MONTH)) -- ?Rob Wultsch17 Oct
        • Re: FLOOR(DATE_ADD(CURDATE(), INTERVAL 4 MONTH)) -- ?Rob Wultsch17 Oct
  • Re: FLOOR(DATE_ADD(CURDATE(), INTERVAL 4 MONTH)) -- ?Dan Nelson17 Oct