number of days per month

Dear members,


I was provided with the date range.
I want to calculate the no. day of each month, within the range of dates above.

e.g. date1 = October 1, 2011' and date2 = 18 March 2011"

for month = 01 number days = 22
for month = 02 number days = 28
for month = 03 number days = 18


Thank you

teefu
Developer
SQL> select to_char(dt,  'mm') month
  2  ,      count(*) count_days
  3  from ( select to_date('10-01-2011', 'dd-mm-yyyy') + level -1 dt
  4         from   dual
  5         connect by level <= to_date('18-03-2011', 'dd-mm-yyyy') - to_date('10-01-2011', 'dd-mm-yyyy')+1
  6       )
  7  group by to_char(dt,  'mm');

MO COUNT_DAYS
-- ----------
01         22
02         28
03         18

SQL> 

Tags: Database

Similar Questions

  • Procedure for the number of working days per month when the user enters to and from everyday

    Hi all

    Can provide you a solution to this - procedure for the number of working days per month when the user enters and days.

    Suppose that the user enters November 18, 2014 start date and date as November 23, 2014.

    The output should display

    Count: 4

    November 18, 2014 Mar

    Sea 19 November 2014

    November 20, 2014 game

    Fri November 21, 2014

    It will exclude Saturday and Sunday.

    Hello

    Here is an example of removing dates Saturday and Sunday:

    with days as(
         select (trunc(sysdate, 'YEAR') + level) as col from dual
         connect by level < 365
    )
    select * from days
    where trim(to_char(col, 'DAY', 'NLS_DATE_LANGUAGE=ENGLISH')) not in ('SATURDAY', 'SUNDAY')
          and col between to_date('18.11.2014', 'DD.MM.YYYY') and to_date('30.11.2014', 'DD.MM.YYYY')
    order by col;
    

    Cheerz,

    Stako

  • How to calculate the number of days/weeks/months between 2 dates?

    Hello

    I would like to know how to calculate the number of days/weeks/months between 2 dates in OBIEE 11 g, for example, I have 26/05/2013 and 19/05/2013, then I want to get 7 days.

    Thank you!
    Jamie

    Hi Jamie,

    Through this links...

    http://www.bravesoft.com/blog/?p=682
    http://twobiee.blogspot.in/2012/01/working-with-date-differences.html

    Mark as correct it allows u...
    Thank you...

  • Data per day, per month, per year

    Hello, there is a field in my table that includes dates.

    I counted my recordings of data per day using the aggregator operator and

    This simple select DATE, COUNT (*) FROM TABLE GROUP BY DATE

    Can you tell me how I count my files per month or per year? Thank you.

    Hello

    You can use functions to retrieve information from the date and use it, for example;

    Select to_char (hiredate, 'YYYY') there, sum (sal) from emp group by to_char (hiredate, 'YYYY');

    So in OWB if you have an expression before the aggregation operator, you can define the expressions and use them in the aggregation.
    See you soon
    David

  • Convert number of dayes per year

    Please I need help to convert many dayes so far

    I have ID as id

    FT * 09025 * 0000000001 date = 20090125

    FT * date 01171 * 0000000002 = 20100620


    therefore must convert number five after FT as from the
    example * 09025 *.

    map 09-2009
    025 dayes annually number card to 25 jan

    example * 01171 *.
    01 card for 2010
    map number 171 of dayes annually to 20 jun
    (jan + Feb + March + April May) (31 + 28 + 31 + 30 + 31) = plus 151

    171-151 = 20 for next month


    Please need help will be so added filter to informatica card with date

    Published by: user8929623 on July 4, 2010 19:04

    Well, I'm not why when 09 maps to 2009, 01 maps to 2010, not in 2001. Assuming that it should be 2001, use YYDDD format:

    SQL> with t as (
      2             select 'FT*09025*0000000001' id from dual union all
      3             select 'FT*01171*0000000002' from dual
      4            )
      5  select  to_date(substr(id,4,5),'yyddd') dt
      6    from  t
      7  /
    
    DT
    --------
    20090125
    20010620
    
    SQL> 
    

    SY.

  • Get number of days of the week to a month

    Hi, someone can tell me how to get the number of working days per month, or the number of days other than Saturdays and Sundays

    Well, others and I already posted an example of use of sysdate?

    Maybe you need to take a look at this again.

    Just trunc sysdate to month: trunc (sysdate, 'mm') = 06/01/2009
    Take the start of the next month less a day: trunc (add_months (sysdate, 1), 'mm')-1 = 30-06-2009 (or use last_day)

    Use a connection level, count the days without the Treaty, and there you go...

  • How can I subtract a number (of days) to a DATE field?

    I have a date field that can be entered manually)

    format (dd/mm/yyyy)

    I would like to be able to take that date and subtract a number from it (say 280 days)

    and do come with the date it would be 280 days in the past in another area

    Date1 < here

    subtract 280 days (as close as possible result of months/days per month etc...)

    Nouvelle_date <-here

    Is this possible at all?

    TIA

    Oh my god

    Thank you very much

    I'll give it a whirl...

  • Count of the number of days in a calendar month according to the year

    Hi all

    On my table, column 1 is the list of months over several years.

    Column 2 is the activity number od each month.

    Column 3 I want an average rate of activity per day during the month, which should be: (C2 / number of days according to C1) %

    Problem: I can't find a fomula give me the number of days, particularly in February when the year is leap.

    Any help is appreciated.

    Thank you all,

    Lopez

    PS: by the way, with this new version of Apple Comunity I seem to have lost my previous questions about the numbers.

    Hey Lopez,

    EOMONTH(A1,0) (end of month) will GET help you.

    Column B is Date & time format to display only the month and year (actually the 1st of the month, but the day is not displayed).

    Formula in C2 (fill down)

    = EOMONTH(B2,0)

    The end of the month 0 months later.

    Formula in D2 (fill down)

    = DAY (C2)

    February 2015 (non-leap years) shows 28

    February 2016 (leap year) shows 29

    Kind regards

    Ian.

  • Hey, I bought the credit card annual plan (per month) for illustrator, but I received my serial number! What should I do? Help!

    Hey, I bought the credit card annual plan (per month) for illustrator, but I received my serial number! What should I do? Help!

    Some general information for a subscription of cloud

    Cloud programs don't use serial... numbers you, connect you to your cloud account paying to download & install & activate... you may need to sign out of the cloud and restart your computer and log into the cloud for things to work

    .

    Your subscription to cloud shows correctly on your account page?

    https://www.adobe.com/account.html for subscriptions on your page from Adobe

    If you have more than one email, you will be sure that you use the right Adobe ID?

    .

    If Yes

    Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud

    -Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html

    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

    -ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp

    -http://helpx.adobe.com/creative-cloud/kb/license-this-software.html

    .

    If no

    This is an open forum, Adobe support... you need Adobe personnel to help

    Adobe contact information - http://helpx.adobe.com/contact.html

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    -Select your product and what you need help with

    -Click on the blue box "still need help? Contact us. "

  • I have creative cloud to 12,19 EUR per month, trial version of Lightroom application serial number. I have no serial number with creative cloud. What should do?

    I have a creative cloud to EUR 12,12 per month account. Lightroom is a trial version for 30 days requesting a serial number. I have no serial number. How to activate trial version of Lightroom to creative Cloud version?

    I test LR5 and just signed to CC with PS/LR - CC app says LR is up-to-date, but LR still wants a license key. Can't seem to download LR as CC downloader does not

  • How to get the maximum number of days in a month?

    How to get the maximum number of days in a month?

    I use a dateField. where I can get the month. Now, I want to get the maximum number of days in a month.

    How can I get it?

    Please help me. and thanks in advance... []

    NET. RIM. Device.API.util
    Class DateTimeUtilities

    getNumberOfDaysInMonth (int month, int year)
    Returns the number of days in the specified month

    It took me like 10 seconds to find it in the API, I guess you spent more time writing the post...

  • Get the number of days in a month based on the month and year of fields

    I have a column in my form which lists the days in a month. I want to configure a hidden field that calculates the total number of days in a month, based on the month and year of the field inputs. The number of days will determine what appears on the column. For example, if I put 4 months, and 2016 in the field of the year, I get 30 in the hidden field. Thus, on the column 'Day', I'll have numbers 1-30. Or if I put 2 months and 2016 in the field of the year, I get the 29 in the hidden field. If the numbers 1-29 appears in the column 'day '.

    Found this on some forum javascript code:

    //Month is 1 based
    function daysInMonth(month,year) {
      
    return new Date(year, month, 0).getDate();
    }

    //July
    daysInMonth
    (7,2009); //31
    //February
    daysInMonth
    (2,2009); //28
    daysInMonth
    (2,2008); //29

    I do not know how to convert this code in JavaScript to adobe and don't really know how to use it. All I know how to do is to configure the field values for the field month and year as variables. I am a novice programmer and would appreciate it really all the help I can get. Thank you in advance!

    The code seems to be JavaScript and runs as needed by using the JavaScript console.

    I would like to consider making more general code, so if you have a date string that includes at least the month and year we could just call the function and get the number of days for that month.

    The following script will calculate the number of days in a month, by using at least the month and year values can display the result on the JavaScript console and all of the value field for the field that has this code as the custom calculation Script.

    function daysInMonth (oDate) {}
    return new Date (oDate.getFullYear (), oDate.getMonth () + 1, 0) .getDate ();
    }

    nMonth var = this.getField("Month").valueAsString; get the value of month;
    nYear var = this.getField("Year").valueAsString; get the value of the year;

    Event.Value = "";

    If (nMonth! = "" & nYear!) = "") {}
    var MyDate = util.scand ("' / mm/yyyy ', nMonth +" / "+ nYear); convert to date object;
    var nDaysInMonth = daysInMonth (MyDate); get the number of days;

    Console.Open (); Open the JavaScript console;

    Console.clear(); clear the console;

    Console.println ("Days in" + nMonth + ":" + nDaysInMonth); show days in month;

    Event.Value = nDaysInMonth; Set the value of the field;

    }

  • Dear Sir/dear Madam, two days ago I registered to use creation of cloud photography package 300 THB per month LR + PS. And I see the promotion for this package 240 THB per month. Could you please help to change promoting 240 THB? Thank you.

    Dear Sir/dear Madam, two days ago I registered to use creation of cloud photography package 300 THB per month LR + PS. And I see the promotion for this package 240 THB per month. Could you please help to change promoting 240 THB? Thank you.

    This is an open forum, not Adobe support... below to connect with Adobe personnel to help

    While the forums are open 24/7 you can't contact Adobe support at any time

    Chat support: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • Hi, I just paid for this 11euros per month thing, for Lr and Psalm I had the trial version installed before and now I paid, I can not connect to the bloody thing, it asks me to enter a serial number, which I do not have... everyone has

    Hi, I just paid for this 11euros per month thing, for Lr and Psalm I had the trial version installed before and now I paid, I can not connect to the bloody thing, it asks me to enter a serial number, which I did not... someone has a solution for me please...?

    Troubleshooting FAQ: What should I do if I have a subscription, but my application acts as if I had a trial?

  • Need to obtain equal records the number of days of the month.

    Dear all

    My table and its data is given:

    Table name: Transaction_Master

    Trn_Num Trn_Dte
    1January 2, 2014
    2January 3, 2014
    3February 15, 2014
    4December 29, 2013
    5December 30, 2013
    and so on

    Now, I wish that my query must return equal records the number of days for each month of Trn_Dte. Be careful, I don't have Trn_Num column in my result. Its cities here only for explanation.

    It should, for example, records 31 to January 31 to December and 28 February.

    I tried following query but it passes loop and my db session gets hang.

    With T as

    (

    Select Distinct (Trn_Dte, 'Month') To_Char Trn_Mon, To_Number (To_Char (Last_Day (Trn_Dte), 'DD')) Tot_Day

    Of Transaction_Master

    Where Trn_Dte between parameter_1 and PARAMETRE_2

    )

    Select Distinct Trn_Mon, level

    T

    Connect by level < = Tot_Day

    Order By Trn_Mon, level

    Could you give me a solution for this case?

    Another solution for your exact needs. Try this and let me know in case of any problems. Because I changed the connection by the clause double itself.

    SELECT DISTINCT TRUNC (Trn_Dte, 'MY') + (lvl - 1)

    OF Transaction_Master aa (SELECT LEVEL lvl

    OF the double

    CONNECT BY LEVEL<= 31)="">

    WHERE Trn_Dte<= to_date('15-feb-2014','dd-mon-yyyy')="" ---="" add="">

    AND TO_CHAR(Trn_Dte,'MON') = TO_CHAR (TRUNC(Trn_Dte,'MON') + (lvl-1), 'MY');

Maybe you are looking for