Re: trunc year

From: <sybrandb_at_hccnet.nl>
Date: Thu, 23 Oct 2008 18:22:16 +0200
Message-ID: <j391g498uhubb87tvaee9mnq6oshd16icu@4ax.com>


On Thu, 23 Oct 2008 03:15:36 -0700 (PDT), muhammaddzulkarnain_at_gmail.com wrote:

>Below is to get date range between a month
>
>SQL> select sysdate,
> 2 trunc(add_months(sysdate,-1),'month') start_date,
> 3 trunc(sysdate,'month')-1 end_date
> 4 from dual;
>SYSDATE START_DATE END_DATE
>---------- ---------- ----------
>21/10/2008 01/09/2008 30/09/2008
>
>
>
>how to get date range between a year?
>
>start_date = 20080101
>end_date = 20081231

A year is 12 months. last_day(add_months..) should do it. Those functions are documented in the SQL refernence manual under 'Date functions' please read it!!!

-- 

Sybrand Bakker
Senior Oracle DBA
Received on Thu Oct 23 2008 - 11:22:16 CDT

Original text of this message