Subject | Re: first and last day of a month |
---|---|
Author | jrodenhi |
Post date | 2009-04-16T15:58:28Z |
--- In firebird-support@yahoogroups.com, masotti <masotti@...> wrote:
SELECT DATEADD(1 - EXTRACT(DAY FROM CURRENT_DATE) DAY TO CURRENT_DATE ),
DATEADD(-EXTRACT(DAY FROM DATEADD(1 MONTH TO CURRENT_DATE )) DAY TO DATEADD(1 MONTH TO CURRENT_DATE))
FROM RDB$DATABASE
Today (04/16/09) I get this:
DATEADD DATEADD1
4/1/2009 4/30/2009
Substitute another date for Current_Date to use this for an arbitrary date.
Jack
>Being able to write your own UDFs in Delphi for Firebird is very handy. If I had to do this in SQL (using the new datetime functions found in Firebird 2.1), I would do this:
>
>
> Sergio H. Gonzalez ha scritto:
> > Hello, this is another "the best way of doing..." question!
> >
SELECT DATEADD(1 - EXTRACT(DAY FROM CURRENT_DATE) DAY TO CURRENT_DATE ),
DATEADD(-EXTRACT(DAY FROM DATEADD(1 MONTH TO CURRENT_DATE )) DAY TO DATEADD(1 MONTH TO CURRENT_DATE))
FROM RDB$DATABASE
Today (04/16/09) I get this:
DATEADD DATEADD1
4/1/2009 4/30/2009
Substitute another date for Current_Date to use this for an arbitrary date.
Jack