Date function to pull back dates of the year?

is there a built in function for returning all dates (whatever format) between to dates ?
Example:
Select functionname('2009/06/01', 'yyyy/mm/dd), ('2009/06/05', 'yyyy/mm/dd')
from dual
Wanted results
2009/06/02
2009/06/03
2009/06/04

Hi,
user11210446 wrote:
Here is what I'm trying to do,
There is a start date and an end date. I have US holidays for current year in a table so for example christmas 12/25/2009
I want to show dates between the start date and end date, and if there is a holiday on that date it will not show.
make sense
so if a user puts 12/23/2009 for start and 12/29/2009
it would show
12/24/2009
12/26/2009
12/27/2009
12/28/2009Yes, that's very clear.
I would actually do that with a NOT IN sub-query
SELECT  TO_DATE ('&start_date', 'MM/DD/YYYY') + LEVEL - 1
FROM     dual
WHERE   TO_DATE ('&start_date', 'MM/DD/YYYY') + LEVEL - 1 NOT IN
        SELECT  appropriate_column
        FROM    holiday
CONNECT BY LEVEL <= 1 + (TO_DATE ('&end_date', 'MM/DD/YYYY') - TO_DATE ('&start_date', 'MM/DD/YYYY'));where &start_date and &end_date are substitution variables in MM/DD/YYYY format. You could use bind variables just as well.
This assumes the DATEs in holdiay are all midnight. If not, use TRUNC (appropriate_column).
Edited by: Frank Kulash on Jun 4, 2009 12:59 PM
There's nothing like clicking that "Save" button to give you better ideas!
MINUS is a little simpler than NOT IN:
SELECT  TO_DATE ('&start_date', 'MM/DD/YYYY') + LEVEL - 1
FROM     dual
CONNECT BY LEVEL <= 1 + (TO_DATE ('&end_date', 'MM/DD/YYYY') - TO_DATE ('&start_date', 'MM/DD/YYYY'));
MINUS
SELECT  appropriate_column     -- or TRUNC (appropriate_column)
FROM    holiday
ORDER BY 1;

Similar Messages

  • Function module to get the dates from the year and the period

    Is there a function Module to get the dates from the year and the period

    Check with :
    To get last day of period use .
    LAST_DAY_IN_PERIOD_GET.
    To get last of month Use :
    RE_LAST_DAY_OF_MONTH
    HRVE_LAST_DAY_OF_MONTH
    LAST_DAY_OF_MONTHS
    ISB_PREVIOUS_PERIOD_DATE_GET
    Thanks
    Seshu

  • Function Module to find the Begin Date of the Year

    Hi Experts,
    Could you let me know if there is a FM to find the "Begin Date of the Year".
    I appreciate your help.
    Thanks a lot.

    Hi,
    Do you want the Begin date of the <b>current</b> year..Try this..
    DATA: V_DATE TYPE SY-DATUM.
    V_DATE = SY-DATUM.
    V_DATE+4(4) = '0101'.
    WRITE: / 'Beginning date of the year ' , v_date.
    If you are mentioning about the Fiscal year..Then you can use the FM PERIOD_DAY_DETERMINE
    Thanks,
    Naren

  • How to find compensation data for the year

    Dear All,
    Scenario:
    A company wants to know the comepnsation data for financial year 2009-2010.
    Problem: I couldnot find a single report which can provide the compensation of an employee for the year.
    We are trying to build a report however needs input if anyone has done that:
    Table which stores this data is PS_COMPENSATION.
    Problem is : it stores data in effective date.
    How to then convert it into a year -April 2010 to March 2011
    For example: cases
    a. existing employee: whose effective comp data will be less than April 2010
    - Plus, there are pay rate changes between April 2010 to march 2011. (Pay rate change can happen on any date of the month)
    - How can I add them to find the Compensation as per comp page from 1st April to 31st march 2011

    I'm afraid what you're looking for is not likely to be a trivial task. If you have all of the modules required for the "Report Total Compensation" product, then you should take a look at the associated PeopleBook. I think you will have to be on HRMS 9.0 at a minimum, and using Payroll for North America and Benefits Administration.
    To create a custom solution, you may have to consider a variety of other factors such job status--leave, terminated, terminated with pay, etc.--hourly vs. salaried, part time vs. full time, multi-job, variable compensation. It will depend entirely on the specific features that are being used at your site.
    If you provide a very detailed example of the output you are looking for with sample data, someone might be willing to offer a solution.
    Regards,
    Bob

  • Sql query to get Thursday (Date) for the year 2014

    Hello All,
    I want to get the date for all the Thursdays in the year 2014. How can I achieve this using SQL query? Can anybody give me a hand with this? Thanks.
    Amol

    Hi,
    Check if this can help you
    DECLARE @counter INT
    DECLARE @Date Date
    SELECT @counter = 0
    Select @Date = '20131226'
    WHILE @counter <= 52
    BEGIN
    select Thursday = convert(varchar(10),DATEADD(WEEK,1, @Date),120)
    SELECT @counter = @counter + 1
    Select @Date = DATEADD(WEEK,1, @Date)
    END
    Regards
    Prasad Tandel
    Please dont forget to mark as answer if this helps you :)

  • P6V7 - Show Finish Date without the year

    I have a project with specific milestone dates. To the left of the each milestone in the Gantt, I expect to show the milestone date in terms of DD-MM and ommit the year.
    When selecting to show the finish date, I get the full date. Is there a way to truncate what is being shown?

    You've been given one solution which is to generate your list of dates and outer join to that.
    It's also possible you could make use a partition outer join (introduced in Oracle 10).
    http://www.oracle-developer.net/display.php?id=312
    Outlines a couple of possible paths.

  • ICloud payment due date in the year 2050

    Hello,
      I called Apple around 27 September with a problem on having iCloud bill my credit card on 30 September 2012 where the Apple representative seemed to have a challenge understanding my issue.
      So 30 September came and went and now my iCloud account says the next payment due date is 30 September 2050.  It is the same on my wife's account as well.  I have no problem paying $40 a year since I use to pay $99 with MobileMe.  I don't want to lose my e-mail and other stuff is the issue.
      Please let me know if you have seen or had the issue or it is anything to worry about.  My credit card has not been billed yet.  For our teenage son when I set up his iCloud account I was billed immeadiately so I take it there is some issue on payment processing for existing customers.
      Any advice would be greatly appreciated.  Thank you

    Obviously the date is an error: Apple are apparently aware and are dealing with it. I assume you had the free extension as a MobileMe migratee but wish to continue using it and pay for it: you will need to cancel the downgrade - you should be able to do that now, and then you will be charged when Apple sort this out (or possibly in 2050 if you're very very lucky ).

  • Datename(Month) - need to change it to show Dates across the Year

    Hi,
    Just wondering if anybody can help, I've tried using the selectdatename(dw,getdate())
    function replacing the Month,getdate())
    to show results on a daily basis, it doesn't seem to work.
    I also need to show all options in a column list from field dbo.trainee.scheme
    My current query -
    SELECT
    * FROM 
    Select
    LEFT (DATENAME(MONTH,dbo.epidata.TR_END),3)
    AS Mnth,
    count(distinct
    epidata.ident)
    as 'Learners'
    FROM [Babington1].[dbo].[epidata]
    join [Babington1].[dbo].[Trainee]
    on [Babington1].[dbo].[epidata].[ident]
    = [Babington1].[dbo].[Trainee].[ident]
     WHERE
    dbo.epidata.TR_END
    >= '20140801'
    AND dbo.epidata.TR_END
    < '20150801'
     ----AND dbo.Trainee.SCHEME = 'apps'
    group
    by dbo.epidata.TR_END
    )s
    PIVOT
    SUM(learners)
    FOR  Mnth
    IN
    ([Aug],[Sep],[Oct],[Nov],[Dec],[Jan],[Feb],[Mar],[Apr],[May],[Jun],[Jul])
    )P
    My current results look like
             Aug Sep Oct Nov Dec
    1        302 211 231 50 NULL
    I would like my final result to look like -
                           Wk1 | Wk2 | Wk3 |  Wk4  |  Wk5
    Scheme Title      1          2        0        1         1
    Scheme Title 
    Scheme Title

    if you want weeks what you need is this
    SELECT * FROM
    Select 'Wk' + RIGHT('00' + DATENAME(Wk,DATEADD(wk,DATEDIFF(wk,0,dbo.epidata.TR_END),0)),2) AS Wk,
    count(distinct epidata.ident) as 'Learners'
    FROM [Babington1].[dbo].[epidata]
    join [Babington1].[dbo].[Trainee] on [Babington1].[dbo].[epidata].[ident] = [Babington1].[dbo].[Trainee].[ident]
    WHERE
    dbo.epidata.TR_END >= '20140801'
    AND dbo.epidata.TR_END < '20150801'
    ----AND dbo.Trainee.SCHEME = 'apps'
    group by DATEDIFF(wk,0,dbo.epidata.TR_END)
    )s
    PIVOT
    SUM(learners) FOR Wk IN
    ([Wk01],[Wk02],[Wk03],[Wk04],...,[Wk53])
    )P
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • In Numbers, how can i change only the year in a date formatted column of data?

    I'm using Numbers 3.5.2 on an iMac running Yosemite 10.10.2.
    This column is a listing of dates tied to info that needs to happen on a particular date each year. Rather than re-key all the dates so the year advances to 2015, it would be great if I could change just the year for the entire column, leaving the day and month intact.
    Thanks in advance for your help.

    If you already have a column of dates, and just want change the year in the entire column, rather than reenter the dates,  then you could use a formula something like this:
    The formula in B2, copied down the column:
        =DATE(YEAR(A2)+1,MONTH(A2),DAY(A2))
    Then select the new column, command-c to copy, and Edit > Paste Formula Results. The original column can then be deleted.
    SG

  • Query returns data from previous month. Need to have it return data for the entire year

    This is the part of the query that returns data by month:
    (YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)AND MONTH(`rereport`.`market_reports_5`.start_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH))
    How can I get it to return data for the year.
    TIY

    How about omitting the MONTH part:
    (YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • How to calculate first date and end date of this year in Query

    Hi Expert
    I want to calculate following dates with inputted date in query.
    I have no knowledge on ABAP and I just can create a query with simple logic.
    Could you teach me how to calculate following date?
    (If inputted date is April 12 2009)
    - First date of this year (Ex January 1 2009)
    - End date  of this year (Ex December 31 2009)
    - First date of last year (Ex January 1 2008)
    - End date of last year  (Ex December 31 2008)
    - First date of this month (Ex April 1 2009)
    Thank you!
    Take

    HR_JP_MONTH_BEGIN_END_DATE   use this FM to get the begin and end date of the Date you are passing. eg when u give input as 04/12/2009, it will return
    04/01/2009 as begin date
    04/30/2009 as end date
    pass the Year in this FM HR_E_GET_FISC_YEAR_DATES, you will get the Fiscal year Begin and End Dates
    Abh

  • Itunes has changed the way it stores files over the years and now i am having trouble figuring out which files are where so I can back them up

    Hi
    I have backed up itunes by copying my itunes file to an external hard drive. I try to keep my large media files (like TV shows) in a separate folder so that I can keep my hard drive on my macbook from filling up.  Problem is, apple has changed the way Itunes is organized and backs up over the years.  Now I am having a hard time keeping straight what is where.  When I go to support, it has different instructions for the various versions of itunes. I  am using version 10 now but it seems like I can't see all my files within the itunes music or media folder.  I want to get everything in one place so that I can easily back up, regardless of which version of itunes I am running at the time.
    I have selected to let itunes organize my files.  It keeps all the files I have purchased in one place apparently, but items I have imported don't seem to always be there.
    How can I best sort this out?

    I have, but if I don't have that particular external hard drive connected when my time machine backup hard drive is connected, then I don't think it is all backed up together.  It is getting too complicated to get out all this equipment every time I want to buy some music. 

  • APO-DP : Change in Fiscal Year Variant for the year 2008

    As per earlier Fiscal Year variant configuration, the data has been forecasted in APO system till the end of Year 2008. But recently the fiscal year variant configuration modified in R/3 which has been impacting APO-DP storage buckets which are not matching with that of earlier fiscal year variant. So, there is a mismatch in the storage bucket profile where in the data already stored in “Weekly, Monthly and Posting Period” based on the earlier Fiscal year 2008 configuration.
    Now the system is not allowing to do any Interactive Planning.
    The business would like to use the latest fiscal calendar and also not ready to loose the forecasted data for the year 2008. So, we are not in a position to deactivate and reactivation of Planning Area and also we are not using back-up infocubes functionality.
    Please update me if anybody experienced this type of situation or know the solution.

    I think your suggestion should work but it takes more resource time and need more database size.
    I am thinking to retain some important forecast keyfigures data in the following workaround method;
    1) Now the Planning Area Initialized for 2yrs historical + 1Yr forecast horizon
    2) Run first set of new macros to copy from year (say 2008) to year (say 2006)
    3) Re-initialize the Planning Area (Jan'2006 to Dec'2007)
    4) Re-build the New Fiscal Calendar from R/3
    5) Re-initialize the Planning Area for history and forecast horizon (ex: from Jan'2006 to Jan'2009)
    6) Run second set of new macros to copy back ( ex: from 2006 to Year 2008) and wipeout the duplicate records in 2006
    7) The above macros can be utilized to run every year end when ever the new fiscal calendar introduced
    Suggestions are welcome

  • How to get a week number  for the year using oracle sql query?

    hi everyone,
    i have the requirement to find the week number for the calender..
    so that week number should start with 01 when the year starts and it should end with week end date(that is first saturday of the january month).. so next week number starts with sunday and ends with saturday ,continously.. in the end date of the year it should not be 'saturday' but week number should end with last date of the year.. again in the next year it should start with '01'.
    for example:
    01-JAN-13 tuesday 01
    02-JAN-13 wednesday 01
    03-JAN-13 thursday 01
    04-JAN-13 friday 01
    05-JAN-13 saturday 01
    06-JAN-13 sunday 02
    07-JAN-13 monday 02
    26-DEC-13 thursday 52
    27-DEC-13 friday 52
    28-DEC-13 saturday 52
    29-DEC-13 sunday 53
    30-DEC-13 monday 53
    31-DEC-13 tuesday 53
    01-JAN-14 wednesday 01
    02-JAN-14 thursday 01
    how can i achieve this, can anyone please help me out on this..
    i have a query that starts with 01 when year starts but it gives problem in the end of the year .. described below with a query..
    select mydate,
    to_char(mydate,'day') as weekday,
    to_char(next_day(mydate,'sunday'),'iw') as week_num
    FROM ( SELECT TRUNC (SYSDATE, 'yy') - 1 + LEVEL AS mydate
    FROM dual
    CONNECT BY LEVEL <= (SELECT TRUNC (ADD_MONTHS (SYSDATE, 24), 'yy')
    - TRUNC (SYSDATE, 'yy')
    FROM DUAL))
    this query gives date, weekday and week_num for 2 years 2013 and 2014,
    when i run this query ,at the end of the 2013 it gives the result as,
    26-DEC-13     thursday      52
    27-DEC-13     friday      52
    28-DEC-13     saturday      52
    29-DEC-13     sunday      01
    30-DEC-13     monday      01
    31-DEC-13     tuesday      01
    01-JAN-14     wednesday     01
    02-JAN-14     thursday      01
    for dates 29 ,30,31st it should give 53 .. how can i achieve that using this this query .. can any one help me out on this please...
    thanks,
    pradeep

    I tried with the IW ...
    it is giving week_id for the year.
    select
    mydate,
    to_char(mydate,'day'),
    case when mydate between trunc(mydate,'yyyy') and next_day(trunc(mydate,'yyyy'),'saturday')
    then to_number(to_char(mydate,'yyyy')||to_char(trunc(mydate,'yyyy'),'iw'))
    when mydate between next_day(trunc(mydate,'yyyy'),'saturday') and trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d')-1
    then to_number(to_char(mydate,'yyyy')||to_char(next_day(mydate,'sunday'),'iw'))
    when mydate between trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d') and add_months(trunc(mydate,'yyyy'),12)-1
    then to_number(to_char(mydate,'yyyy')||to_char(trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d')-1,'iw')+1) end as WEEK_ID
    FROM ( SELECT TRUNC (SYSDATE, 'yy') - 1 + LEVEL AS mydate
    FROM dual
    CONNECT BY LEVEL <= (SELECT TRUNC (ADD_MONTHS (SYSDATE, 24), 'yy')
    - TRUNC (SYSDATE, 'yy')
    FROM DUAL
    ))

  • Unfortunately, I lost by an update all the apps on my iPad 2. Now I can not pull the data from the cloud to my iPad. How is this possible?

    Unfortunately, I lost by an update all the apps on my iPad 2. Now I can not pull the data from the cloud to my iPad. How is this possible?

    If you just installed iCloud does that mean you updated the iOS that's running on your iPad?  If so, you'll want to restore all the programs you have from the backup you hopefully made.
    Refer to these articles for help.
    iTunes: Backing up, updating, and restoring iOS software.
    If you don't want to use iCloud, simply don't activate it.
    You can also download the programs again.
    If you live in a country that supports re-downloading apps then you can re-download them.  You can refer to this article for more help.
    Downloading past purchases from the App Store and iTunes Store
    What to know if your country supports downloading past purchases?
    iTunes in the Cloud Availability

Maybe you are looking for

  • What is Logic's strongest selling point?

    I use and love Logic. I also have Ableton and admire it for it's innovation. My bandmate uses Cubase 5 and my mastering engineer uses Pro Tools. All of these DAWs seem to have one or more mains selling points. _Abelton Live's_ sells its innovate way

  • Recording sound directly to the iPod

    I assume that this is possible. A Belkin mic and some software are all that are required?

  • Set up mail with personal domain

    Hi all, I bought a domain in Godaddy, and its working properly with outlook. My iPhones and all other devices are working perfectly with that email setups, now Im trying to setup that account into Mail but its doesn't recognise the email. I already f

  • Iphoto won't open any more after software update

    Hi, I just had an automatic software update on my computer (Macbookpro OSX 10.6.8), and when I attempt to open iphoto, the following message window opens... Help! Many thanks Process:     iPhoto [431] Path:        /Applications/iPhoto.app/Contents/Ma

  • Tutor License Error

    Hi All, i found an error that i need license key for SAP tutor version 2.2 for my laptop i have some files of SIM i want to run them. how i can get license. regards, qsm sap