Function to get last friday of each year?

Dear all,
I have a technical problem, how can I know the last friday of each year. What function I need to use in order to get this value for each year?
Please advice.
Best Regards,
Amy

And to prove michaels' point, here it is for several years:
SQL> with years as
  2  ( select add_months(date '1990-01-01',12*level) jan_1
  3      from dual
  4   connect by level <= 17
  5  )
  6  select jan_1
  7       , next_day(jan_1-8,'VRIJDAG') last_friday_previous_year
  8    from years
  9  /
JAN_1               LAST_FRIDAY_PREVIOU
01-01-1991 00:00:00 28-12-1990 00:00:00
01-01-1992 00:00:00 27-12-1991 00:00:00
01-01-1993 00:00:00 25-12-1992 00:00:00
01-01-1994 00:00:00 31-12-1993 00:00:00
01-01-1995 00:00:00 30-12-1994 00:00:00
01-01-1996 00:00:00 29-12-1995 00:00:00
01-01-1997 00:00:00 27-12-1996 00:00:00
01-01-1998 00:00:00 26-12-1997 00:00:00
01-01-1999 00:00:00 25-12-1998 00:00:00
01-01-2000 00:00:00 31-12-1999 00:00:00
01-01-2001 00:00:00 29-12-2000 00:00:00
01-01-2002 00:00:00 28-12-2001 00:00:00
01-01-2003 00:00:00 27-12-2002 00:00:00
01-01-2004 00:00:00 26-12-2003 00:00:00
01-01-2005 00:00:00 31-12-2004 00:00:00
01-01-2006 00:00:00 30-12-2005 00:00:00
01-01-2007 00:00:00 29-12-2006 00:00:00
17 rijen zijn geselecteerd.Regards,
Rob.

Similar Messages

  • Why doesn't the Calendar allow one to schedule the last Friday of each month?

    Why doesn't the Calendar allow for making repeating appts. like the 1st Saturday of each month or the last Friday of each month?  This is such fundamental functionality. Virtually all other third-party calendar apps include this feature. I was very disappointed this wasn't addressed in iOS 5.  Hopefully an Apple Support person sees this...  

    Apple support people don't participate here. You can leave feedback for any feature that you want to see included in an update via this link.
    http://www.apple.com/feedback/ipad.html

  • User defined function for getting last string in the line

    Hi Experts,
    I am not java expert, can anyone give me user defined function for getting last string in the line.
    for example if the source field is "NEW ARBOUR SQUARE"  i want to pass to target field only last string that is "SQUARE"
    please help me out of this.
    Kind Regards.
    Praveen.

    You don't even need a UDF for this. In the graphical editor look for the standard functions and once you do a scroll over on 'text functions; you will find what you are looking for.
    Just a piece of advice, try keeping UDF's to minimum unless really required or it is complicated without it.
    regards

  • Function to get starting date of financial year ??

    Hi,
       what is the Function to get starting date of financial year. I am developing a inventory report, for that i need; start of the factory opening date. Is that factory n financial year are in the same date.
    Thanks,
    Senthil

    SEE THIS FMS.
    TSTR_PERIODS_FACTORYCALENDAR
    FACTORY_CALENDAR_GET
    RH_READ_CALENDAR

  • Date: Is it possible to get the last Friday of each month?

    Hello all, I am trying to create a column of dates which are a specific day in each month, e.g. the last Friday of every month, or the first Monday of every month. Is this possible, and if so could you please guide me on how to?
    Thanks
    James

    James,
    My thought was that you would create an array of dates with this table and Copy/Paste Values it into the range where you need it.
    What I did was build a table of controls, below, where I set the year and what day of the week you were interested in and the top table will compute the dates. I used direct entry for the year and a POP-UP menu for day of the week.
    The 4th 'Friday' formula is: =IF(Controls :: $C>$C, $B+Controls :: $C-$C+21, $B+Controls :: $C-$C+28)
    The Last 'Friday' formula is: =IF((G+7)>EOMONTH(B, 0), G, G+7)
    The formula in the Header Row is: ="4th "& Controls :: $B , etc.
    There is no reason you couldn't transpose the table to have your Last Fridays in a row rather than in a column. I don't think I noticed that requirement in your original post.
    And, there's no reason to have a fancy control panel if you don't think you'll ever need to create another series of dates. Just substitute values for the references to the control table.
    Jerry

  • How to get last day of the year

    Hi All ,
    Thanks in advance ...
    How will I get the last day of the year as I am passing date at run time .
    I can manage to get first day of year by
    SELECT TRUNC(SYSDATE,'YEAR') AS FDAY_YEAR
    from dual
    Thanks in advance
    Regards
    Sachin

      1*  select ADD_MONTHS(trunc(sysdate,'yyyy'),12)-1 dd from dual
    SQL> /
    DD
    31-DEC-2010

  • URGENT - BI Publisher - Get Last Date of Month/Year

    Hello,
    I want to get the last date of a year/month through BI Publisher. We want to do it by creating a list of values containing the month/year name (i.e. January, February, March for month or 2004 2005 2006 for year) and when the user selects one of this values to get the last date of the month or year in order to select the correct number of records.

    Hi,
    try with a LOV like the following:
    select
    to_char(add_months(trunc(sysdate,'MONTH'),-level),'Month - YYYY') display_value,
    last_day(add_months(trunc(sysdate,'MONTH'),-level)) return_value
    from dual
    connect by level <=12
    which gives you the last 12 month from today.
    Regards
    Rainer

  • Function Module to get Last date of previous year

    Is there any function module to get the Last date of the previous year. e.g, if i give date as 03/02/2009 the output  should be 31/12/2008.

    pls use below 2 FM's
    CALL FUNCTION 'MONTH_PLUS_DETERMINE'
              EXPORTING
                months  = -1
                olddate = curent_date
              IMPORTING
                newdate = w_prevdate.
    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
              EXPORTING
                day_in            = w_prevdate
              IMPORTING
                last_day_of_month = w_lastdayprevmonth
              EXCEPTIONS
                day_in_no_date    = 1
                OTHERS            = 2.

  • TO FIND LAST DAY OF THE YEAR

    I am trying to get last day of the year, is oracle provide any inbuilt function to get this otherwise I am using the below mention query is fine.
    select last_day(to_date('01'||'/'||'12'||'/'||to_char(sysdate,'YYYY'),'DD/MM/YYYY')) from dual
    Thx
    Shishu Paul

    Hi!
    I would prefer using
    select to_date('31'||'/'||'12'||'/'||to_char(sysdate,'YYYY')) from dual;
    since it is not likely that the last day of any year in near future will be anything else than December 31st.
    Regards,
    Petra

  • Function to get quarter

    Hi all
    Hi , is there any function to get Current Quarter of the year??
    Thank you all

    Take the following for example.....
    report zrich_0001.
    data: xspbup type spbup.
    data: xgjahr type bkpf-gjahr.
    data: xpoper type t009b-poper.
    data: check_spbup type spbup.
    ranges: q1 for xspbup.
    ranges: q2 for xspbup.
    ranges: q3 for xspbup.
    ranges: q4 for xspbup.
    q1-sign = 'I'.
    q1-option = 'BT'.
    q1-low+0(4) = sy-datum+0(4).
    q1-low+4(2) = '01'.
    q1-high+0(4) = sy-datum+0(4).
    q1-high+4(2) = '03'.
    append q1.
    q2-sign = 'I'.
    q2-option = 'BT'.
    q2-low+0(4) = sy-datum+0(4).
    q2-low+4(2) = '04'.
    q2-high+0(4) = sy-datum+0(4).
    q2-high+4(2) = '06'.
    append q2.
    q3-sign = 'I'.
    q3-option = 'BT'.
    q3-low+0(4) = sy-datum+0(4).
    q3-low+4(2) = '07'.
    q3-high+0(4) = sy-datum+0(4).
    q3-high+4(2) = '09'.
    append q3.
    q4-sign = 'I'.
    q4-option = 'BT'.
    q4-low+0(4) = sy-datum+0(4).
    q4-low+4(2) = '09'.
    q4-high+0(4) = sy-datum+0(4).
    q4-high+4(2) = '12'.
    append q4.
    call function 'FI_PERIOD_DETERMINE'
         exporting
              i_budat = sy-datum
              i_periv = 'YT'
         importing
              e_gjahr = xgjahr
              e_poper = xpoper.
    check_spbup+0(4) = xgjahr.
    check_spbup+4(2) = xpoper.
    if check_spbup in q1.
      write:/ 'This date is under Q1'.
    endif.
    if check_spbup in q2.
      write:/ 'This date is under Q2'.
    endif.
    if check_spbup in q3.
      write:/ 'This date is under Q3'.
    endif.
    if check_spbup in q4.
      write:/ 'This date is under Q4'.
    endif.
    Regards,
    Rich Heilman

  • Last day of each month in a year based on a Input date?

    Hi all,
    I have a request from a customer who wants to have a yearly report created in BEx Query Designer which starts in January up to December and they want to have a Month To Date (MDT) and Year to Date (YTD) calculation of a key figure. This report will only show one year at the time based on the date the user give as input at the Variable Screen.
    This key figure should be calculated by using the last date of each month for input when performing the MTD and YTD calculation and summarizations.
    Example:
    January: 31.01.2008  Key Figure = 1000. MTD = 1000 and YTD = 1000
    February: 29.02.2008  Key Figure = 2500. MTD = (2500-1000) 1500 and YTD = 2500
    March: 31.03.2008  Key Figure = 6000. MTD =(6000-2500)=3500 and YTD = 6000
    Etcu2026.
    This means that I have to have a lot of hidden Key figures which gets restricted on the different month end dates and formulas to calculate the different MTD and YTD results for the months as the year progresses.
    The way I have solved it now is that I have a Customer Exit which gives me the Last day of last year (Exp: 31.12.2007) based on input date and use a Offset on the last day of last year date to get the different last dates of each month.
    Since we have a leap year (one extra day in February) this year, the offset to calculate the end month dates will be different for 2007 and next year (2009). This solution is not very flexible, and it will not give the correct MTD and YTD if the customer wants to go back to 2007 and off course next year (2009).
    One solution is to create 12 Customer Exits that gives me the different month end dates (January-December), and also takes in account leap year for February for the different years. These Exits will be based on the Input date the Customers put in at the variable screen.
    I would rather want to avoid making 12 new customer exits and want your advice and expertise to find out if this is possible in any other way (maybe with only 1 customer exit) to get the last date of each month based on an input date.
    Thanks for all your advices on beforehand.
    Regards
    Oddmar Lid

    Hi,
    Thanks for you replay and documentation, but it doesn't give me excatly the functionality I'm after. The only MTD calculation code the document provides is the calculation of the following functionality:
    "Month to Date (MTD) u2013 From the 1st of month to u201CKey Dateu201D - for current year." This doesn't give the the functionality I want, which is to retrieve a given vaule for a Key Figure for the last dates of the months in a year to calculate MTD and YTD.
    This way I have created the query is to have multiple hidden Key Figures that calculates the MTD and YTD.
    In Columns in Query Designer it will look something like this:
    Selection: MTD January--> Date = 31.01.2008, Key Figure (Always Show)
    Selection: YTD January --> Date= 31.01.2008, Key Figure (Always Show)
    Selection: MTD February --> Date= 29.02.2008, Key Figure (Always Hide)
    Formula: MTD February --> MTD February - MTD January (Always Show)
    Selection YTD February --> Date = 29.02.2008, Key Figure (Always Show)
    And so on....
    This is off course a simplified version, but it shows the core of the solution. What I want to achive here is that the dates used to get the Key Figures (last date of a month) is calculated as flexible as possible, so that the users can go back and forth in time without worrying about the leap year problem and so on. I have now used an offset from the last date of last year and this is good for all the normal years, but when it is a leap year the query will use wrong dates to get the key figure vaule for the last date of each month.
    Any ideas on how to achieve this without creating 12 different Customer Exit variables (one for each end date of each month)?
    Thanks
    Regards
    Oddmar Lid

  • How to get Last Year Sales and YTD Sales without using AGO and TODATE?

    Hi all,
    I have got Company and Time dimensions and Sales Fact. My requirement is to get Last Year sales for each company without using AGO function and YTD without using TODATE function. (Due to performance issue as AGO and TODATE do not insert a Cache entry).
    Can someone please help me to achieve my requirement? Thanks in advance.

    Hi Satya,
    Thanks again for your reply. To start with I don't have data for the years 2012 and 2011 to test as I am using SH sample schema from Oracle. I have applied your solution but it does not seem to be working for the previous years like 2000, 2001. My requirement is to have a dashboard prompt "YEAR" and let the user choose whatever year he wants.
    Please have a look at the column formulas of my analysis (As per your solution) :
    ***here B_YEAR is replaced by CALENDAR_YEAR.  
    Amount: "F1 Sales"."Amount"
    AmountYTD:  FILTER("F1 Sales"."Amount" USING "D1 Time"."CALENDAR_YEAR" =YEAR(CURRENT_DATE))
    Amount LY: FILTER("F1 Sales"."Amount" USING "D1 Time"."CALENDAR_YEAR" =YEAR(CURRENT_DATE)-1)and the physical query generated by BI Server: (as you can see I have got a filter CALENDAR_YEAR= 2000)
    WITH
    SAWITH0 AS (select sum(T1074.AMOUNT_SOLD) as c1,
         sum(case  when T1035.CALENDAR_YEAR = TO_NUMBER(TO_CHAR(TO_DATE('2012-05-03' , 'YYYY-MM-DD'), 'yyyy'), '9999') then T1074.AMOUNT_SOLD end ) as c2,
         sum(case  when TO_NUMBER(TO_CHAR(TO_DATE('2012-05-03' , 'YYYY-MM-DD'), 'yyyy'), '9999') - 1 = T1035.CALENDAR_YEAR then T1074.AMOUNT_SOLD end ) as c3,
         T1035.CALENDAR_MONTH_DESC as c4,
         T1035.CALENDAR_YEAR as c5,
         T1035.CALENDAR_MONTH_ID as c6
    from
         TIMES T1035 /* D1 Time */ ,
         SALES T1074 /* F1 Sales */
    where  ( T1035.CALENDAR_YEAR = 2000 and T1035.TIME_ID = T1074.TIME_ID )
    group by T1035.CALENDAR_MONTH_DESC, T1035.CALENDAR_MONTH_ID, T1035.CALENDAR_YEAR)
    select distinct 0 as c1,
         D1.c4 as c2,
         D1.c5 as c3,
         D1.c1 as c4,
         D1.c2 as c5,
         D1.c3 as c6,
         D1.c6 as c7
    from
         SAWITH0 D1
    order by c3, c2 Thanks in advance.

  • 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

  • Any Date function to find date on last friday?

    Hi all,
    Is there any date function module to find out the date on last friday....
    And one more thing....any function module to findout the range of dates for the last week...(i.e) date from last week monday to last week friday.
    Thanking u all in advance.
    Regards,
    Chandra Sekhar

    REPORT  ZSN_FRIDAYTEST                          .
    data: days type p.
    data: date type sy-datum.
    parameters: p_date like sy-datum default sy-datum.
    *-- Get the last Friday
    call function 'DAY_IN_WEEK'
      exporting
        datum         = p_date
    IMPORTING
       WOTNR         = days.
    days = days + 2.
    date = p_date - days.
    write:/ '(Assuming Monday is the first day of the week)'.
    write:/ 'Date Entered:', p_date.
    write:/ 'Last Friday:', date.
    *- Range of dates in last week
    data: date1 type sy-datum.
    data: date2 type sy-datum.
    data: days1 type p.
    data: days2 type p.
    call function 'BWSO_DATE_GET_FIRST_WEEKDAY'
      exporting
        date_in        = p_date
    IMPORTING
       DATE_OUT       = date1
    date1 = date1 - 7.
    date2 = date1 + 4.
    write:/ 'Range:', date1, '-', date2.

  • FM for getting Last 3 years

    Hi experts,
       Can any body tell me how to get last three years from current year using FM.
    Which function module is suitable for this?
    2011- need to get 2008 2009 2010
    Thanks in advance,
    Veena.
    Moderator Message: Basic Date-related questions are not allowed.
    Edited by: kishan P on Apr 15, 2011 2:57 PM

    at first you need a proper definition what the last three years means.
    If i give you todys date 04/15/2011 what do you expect ? 05/14/2008 - 04/15/2011 ? or just 05/14/2008
    or maybe really calculated 1096) days back? Do you need a interval or all the days between then and now or what exactly do you need?
    Once you know that you will have done a short abap within 5 minutes which does what you need.

Maybe you are looking for

  • How do I reduce the file size of a video?

    I need to reduce the size of a video in imovie to 200 MB.  Can anyone help me please?  Thank you.

  • Linking issue

    Hi guys i have been struggling linking my webpage to my forum any ideas ??? i have done a few links but this one doesnt wanna go at all

  • How to get the last row

    I have 10 rows in my table and I have to retrive last row using rownum. For this I use SELECT * from <table_name> where rownum<=10 minus SELECT * from <table_name> where rownum<=9 The result is no rows selected In the same case if I use SELECT rownum

  • Aperture 3.1 doesn't work with iMovie '09???

    Aperture update came through today. I did the update and Aperture seems to be working fine so far, however, I can no longer view my Aperture library in iMovie '09. All it does is sit and spin the little wheel and has the text "Loading Aperture Images

  • Buttons and links not working...

    I made my website on my iMac, put in on a FlashDrive, and when I take it up to my Windows computer, the buttons at the top do not appear and some of the links don't work. Also, I used Photoshop to get rid of the white space around a diamond shaped im