Second Friday of the month

How could I get the second Friday of the month, given the month and year. In particular, want to know the second Friday of February and September for the whole year as next year or three years ago.

Hello

Assuming your NLS_DATE_LANGUAGE is in English:

NEXT_DAY ( TO_DATE (s, 'Mon YYYY') + 6
      , 'FRI'
      )          AS second_friday

where s is a string like "Sep 2011".

To_date without a day of the month returns the 1st of the month.
Add 6 and you get at the end of the first week of this month.
NEXT_DAY reutns overnight with the abbreviation data (or name) after (not on) the 1st argument.

Tags: Database

Similar Questions

  • OBIEE 11 g: how to find the 2nd Friday of the month

    Hello

    How to find the 2nd Friday of the month using the current date in obiee 11g.

    Thanks in advance.

    Kind regards

    MIT.

    Hey MIT,

    You can try with something like this:

    TIMESTAMPADD (SQL_TSI_DAY, TIMESTAMPADD (7 + 6-DAYOFWEEK (TIMESTAMPADD (SQL_TSI_DAY, 1-DAYOFMONTH (CURRENT_DATE), CURRENT_DATE))), (SQL_TSI_DAY, 1-DAYOFMONTH (CURRENT_DATE), CURRENT_DATE))

    It can still be improved to probably avoid transformations 1-2, but at least he does.

    You will need to check what return DAYOFWEEK in your environment for Friday (in mine Friday = 6) as if she does not return to Friday 6, you will need to adjust the formula.

    The idea is to find what day is the first day of the month, since then visit the first Friday (or just stay there if the first day is a Friday). This is done by the DAYOFWEEK 6 (first day of the month).

    And now, you just add more 7 days, so that's why there is a 7 + 6 - DAYOFWEEK (first day of the month) to make it easier to read and understand (instead of 13-...).

  • find the 3rd Friday of the month at a given date

    How can 3rd Friday of the month at a given date? I can always spend the first day of the month as input

    for example, the effective date is 1 January 09. need to get the 3rd Saturday 16 January 09 (Jan has 5 Friday 02, 09, 16,23,30)

    entry date: 1 February 09, needed 20 February 09

    Published by: user520824 on April 1st, 2009 12:30

    How about you...

    select trunc(sysdate,'mm') + (6 - to_char(trunc(sysdate,'mm'),'d')) + 14 from dual;
    
    TRUNC(SYS
    ---------
    17-APR-09
    
    select trunc(to_date('01-JAN-09'),'mm') + (6 - to_char(trunc(to_date('01-JAN-09'),'mm'),'d')) + 14 from dual;
    
    TRUNC(TO_
    ---------
    16-JAN-09
    
    select trunc(to_date('01-FEB-09'),'mm') + (6 - to_char(trunc(to_date('01-FEB-09'),'mm'),'d')) + 14 from dual;
    
    TRUNC(TO_
    ---------
    20-FEB-09
    
    select trunc(to_date('01-MAR-09'),'mm') + (6 - to_char(trunc(to_date('01-MAR-09'),'mm'),'d')) + 14 from dual;
    
    TRUNC(TO_
    ---------
    20-MAR-09
    
  • Find "the third Friday of the month.

    I try to use OPA to generate a set of dates based on a number of different criteria, such as the first of each month, once a fortnight and various others. I'm fighting with that is, as the title suggests. Is it possible under rules for a set of date such as results variables, for example, will be the third Friday of each month?

    To be clear, if I enter a start date of July 19, 2011 and I put criteria like the last day of the month, I should be back July 31, 2011, August 31, 2011, September 30, 2011 and so on. (I realized that in a roundabout way, using the functions ExtractMonth, ExtractYear and MakeDate.)

    If I go into 19 July 2011, and the criterion is the second Tuesday of each month, I want to on 9 August 2011, September 13, 2011, October 11, 2011. Is there a way that someone can think that this could be done? Without using masses and masses of tables Excel days and dates (which makes the project too large to function properly) I can't find a solution, so any help would be welcome. Thank you.

    You can use the functions NextDayOfTheWeek (to get the first Friday) with AddWeeks (to get the third Friday, based on the knowledge the first Friday).

    That would give you a single output date based on a single date of entry. If you wanted a timeline of dates (i.e. a temporal attribute), then you should look at using some functions of temporal reasoning as well.

  • For the second time in two months, all my messages in the Inbox are not there. Only the SUBJECT and the FROM is left. Tried to 'fix this folder' and lost ALL

    For the second time in two months, all my messages in the Inbox are not there. Only the SUBJECT and the FROM is left.

    Tried to 'fix this folder' and ALL - lost ALL the Inbox.

    The file is still there and works well...

    How can I stop it and what are the causes?

    Thank you all, Gabe

    If you have the file somewhere on your hard drive, export and import tools it will be important back to Thunderbird.

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ImportExportTools/

    Instructions http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html

  • For the second time in six months, Thunderbird seems to have lost all my emails content.

    I have Thunderbird loaded on a MacBook Pro. For the second time in six months, disappeared the conent of all emails. I have a list of emails, but the content does not appear in the reviewing pane or if I open the e-mail. I made no changes to the computer Professor at Thunderbird. It's very frustrating! Any ideas as to what is happening?
    Mike

    Do you also have an anti virus program for the second time in six months has quarantined you Inbox?

  • How to repeat an event every month, and that the event referred to the previous Friday if the event falls on a weekend.

    Company is paid twice a month. The 15th and the last day of the month.

    Defining the last day of the month would repeat each month, day of the last week. But how do you define the 15th with these conditions:

    If the 15th falls on the weekend, it will be Friday before the weekend. For example, May 15, 2016 falls on a Sunday, the event must be moved to May 13 instead. Is this possible?

    Thank you!

    Found the answer.

    Snow Leopard iCal - event on Friday if the Nth is a weekend/holiday?

  • TIME REMAINING IN SECONDS FROM THE END OF THE MONTH

    Dear all,

    How to calculate the time remaining is seconds to the end of the month?

    time difference in seconds of sysdate to the last day of the month till 23:59:59

    Thanks in advance

    Hello

    SELECT (ADD_MONTHS (TRUNC (SYSDATE, 'MONTH')

    1

    )

    -SYSDATE

    ) * 24 * 60 * 60 AS seconds_left

    DOUBLE;

    SYSDATE is the date and time.

    TRUNC (SYSDATE, 'MONTH') is the beginning of the current month

    ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), 1) is the beginning of the next month

    ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), 1)-SYSDATE is the number of days (not necessarily an integer) by the end of the month

    (ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), 1)-SYSDATE) * 24 is the number of hours (not necessarily an integer) by the end of the month

    ...

  • How to find the first Sunday and the second Saturday of each month

    Hi all

    How to find the first Sunday and the second Saturday of each month

    Thank you

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    994122 wrote:

    Hello

    I need to pass the months parameter how to do this? like Jan, Feb etc... (one of those)

    Do you have a procedure?

    Should you output only for the months you passed in the parameter?

    The easiest way is to set the parameter as date. When you go such as p_date as DATE ' 2014-10-01', then you can

    PROCEDURE two_dates)

    p_date IN DATE

    p_first_sunday DATE

    p_second_saturday DATE

    )

    IS

    BEGIN

    p_first_sunday: = NEXT_DAY (TRUNC (p_date, 'MM') - 1, TO_CHAR (DATE ' 2014-10-12', 'DAY'));

    p_second_saturday: = NEXT_DAY (TRUNC (p_date, 'MM') - 1, TO_CHAR (DATE ' 2014-10-11', 'DAY')) + 7;

    END two_dates;

    Or you describe what you need.

  • How to get the second Monday of each month in a given date range?

    In Oracle forms, how to get the second Monday of each month in a given date range?

    I tried below using the query WITH the Clause, but it seems that WITH Clause does not work in Oracle forms. So is there another way to do this in Oracle forms?

    WITH month_range AS

    (

    SELECT TO_DATE ('Dec 2013', 'Mon YYYY') AS first_month

    , TO_DATE ('Mar 2014', 'Mon YYYY') AS last_month

    OF the double

    )

    SELECT NEXT_DAY (6 + ADD_MONTHS (first_month

    , LEVEL - 1

    )

    , 'MONDAY '.

    ) AS second_monday

    OF month_range

    CONNECTION OF LEVEL < = 1 + MONTHS_BETWEEN (last_month, first_month)

    ;

    Thanks in advance.

    Good fishing, when the first day of the month is Thursday... So I changed the query accordingly... Try the below

    SELECT CASE WHEN TO_CHAR (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'DY') = 'game '.

    THEN NEXT_DAY (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'THU')

    Of OTHER NEXT_DAY (ADD_MONTHS (TRUNC(startdate,'MM'),(LEVEL-1)), 'Game') + 7

    END AS second_day

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

  • I get a message saying "drive does not have the ability to access this service and I just paid for 12 months (FOR THE SECOND TIME) in the last two months!

    I get a message saying "drive does not have the ability to access this service and I just paid for 12 months (FOR THE SECOND TIME) in the last two months!

    Hi phillipt84805120,

    Make sure that you have the latest Adobe Acrobat Reader DC (Adobe Acrobat Reader DC install for all versions) installed on your computer to use the services of export to PDF as the older version of Reader support any more.

    Alternatively, you can use services online at https://cloud.acrobat.com/exportpdf

    Let me know if you are still having a problem.

    Kind regards

    Nicos

  • Why I have not received updates of security for the months of May and June yet?

    My latest updates are from the month of April. My automatic update is enabled. I also tried to update manually, but 0 (zero) updates available. Can I know what is the basis of time to release the updates? A little help here? Thanks in advance.

    Can I know what is the basis of time to release the updates? A little help here? Thanks in advance.

    AldrinMandeoya,

    Updates Microsoft security release the second Tuesday of each month at 10:00 am Pacific time.

    Non-security updates are published on the fourth Tuesday of each month.

    There are no updates normally more than one or two a month out of this cycle.

    Update definitions for Windows Defender and Microsoft Security Essentials will be displayed in the history of the update.

    http://TechNet.Microsoft.com/en-us/security/dd252948.aspx

    06/15 / 1102:57: 46 am

  • RECENTLY I bought the subscription for the month, but then canceled (I think?) because I'm frustrated. I've been using bridge and photoshop cs6 for 4 years. I've never understood light room and where it is located. I've dabbled with it and I could not

    RECENTLY I bought the subscription for the month, but then canceled (I think?) because I'm frustrated. I've been using bridge and photoshop cs6 for 4 years. I've never understood light room and where it is located. I've dabbled with it and I couldn't find out how to save my images in my workflow of currengt, or how to resize and put a border around my images. How to save for web and as TIFF, as I did for all my files for four years. LR seems to be taking pictures of my Iphoto folder and I don't use that. I tried to cancel the cc of photoshop and lightroom cc and cc bridge but I don't know if I did. I am really confused, and I have work to do. What can I do, do I do, help me! @@ !

    Cancel see answer #1 in https://forums.adobe.com/thread/2023066 - includes a link to Chat from Monday to Friday

    Your subscription to cloud or serial number to show on your account page?

    https://Accounts.adobe.com/ , then click on Plans & products top

    Cloud of reading takes up https://forums.adobe.com/thread/2089127 for some ideas

  • HP DV6-6B25TX turn off after 10 to 15 seconds, regardless of the power of the battery or power supply

    Hello

    MY DV6-6B25TX is cutting off after 10-15 seconds, regardless of the battery power or AC power.

    Here's the complete scenario of what happened in recent weeks:--

    Two weeks back I was using the laptop with the power adapter is plugged in for charging, the battery got charged up to 99% then it stopped charging and display the battery icon text, "plugged in, not charging".

    A return of the week, the battery was 20%, after plugging in the charger, always the same message "Plugged in, no charging current".

    Now the laptop does not meet the key power when the battery is inserted.

    If I remove the battery and back again, it starts without pushing the power button and turns off after 10 seconds, well before Windows starts.

    She stops even on the Bios screen, OS is not definitely the question.

    When I plug in charger and press the power button / stop, the same thing, i.e. starts and shutts off after 10 to 15 seconds, regardless of the BIOS or Windows startup screen.

    I removed the ram and but again, but the problem still persists.

    Also there is no issue of overheating due to dust, as I've barely used the laptop for a few hours, the phone is about 6 months and under warranty.

    Please advice ASAP.

    Thanks in advance.

    Honestly, something prevents the battery charge. Computer laptop closing seconds after that reinsert the battery is a good indication the battery just is not getting charged. This could be a battery failure, charger, port, or in rare cases of charge motherboard.

    Since it's under warranty, I recommend you contact HP support that there is no easy solution for this on the forums. It's a hardware problem.

    The number of the Canada and the United States support is 1-800-474-6836.

  • Number of days remaining in the month

    Hi guys,.

    I'm looking to create a function that returns the number of working days (Monday to Friday) between sysdate and the last day of the month.

    If someone has done something similar.

    I tried the following:

    < code >

    CURSOR days_c

    IS

    SELECT THE LEVEL

    , to_char (LAST_DAY (ADD_MONTHS (SYSDATE-1)) + LEVEL,'Dy DD-Mon-YYYY "") AS DOW - day of the week

    OF the double

    WHERE ROWNUM < = EXTRACT (DAY FROM LAST_DAY (SYSDATE))

    CONNECT BY LEVEL = ROWNUM;

    v_cnt NUMBER: = 0;

    BEGIN

    FOR days_r IN days_c

    LOOP

    To_char (days_r.DOW) NOT AS "Sat %" If GOLD to_char (days_r.DOW) NOT LIKE '% of Sun '.

    - AND to_date (days_r.dow) > sysdate

    THEN

    v_cnt: = v_cnt + 1;

    END IF;

    END LOOP;

    RETURN v_cnt;

    < code >

    At the present time, IF logic around the days_r.DOW does not work as I am also bad to only return the greater these days but less dates at the end of the month.

    Thanks in advance

    Chris

    Try this

    SQL > with input_data
    2 as
    (3)
    4. Select sysdate current_day
    5, last_day (sysdate) last_day
    6 double
    7)
    8. select count (*)
    9 of)
    10. Select current_day + (level - 1) d
    input_data 11
    12 connect
    13 by level<= last_day="" -="" current_day="" +="">
    14          )
    15 where to_char (d, 'fmday') not in ('Saturday', 'Sunday');

    COUNT (*)
    ----------
    20

Maybe you are looking for