How to find days between two dates in days

Hi, I want to get the days between two dates, expressed in days, how can I do this?  For example, I date i.e. 1 October 10, 2013 (Thursday) and 2 as October 13, 2013 (Sunday).  How can I get a production of:

Thursday, Friday, Saturday and Sunday, which are the days between Oct. 10-13, 2013.  I hope you understand my point.  Thank you

You can try something like this

CURSOR LOAD_PROF is

SELECT load_prof1, v_time_profile_day

OF load_profile_test

WHERE profile_day IN (select TO_CHAR(:day1+level-1,'Day')

of the double

connect by level<>

);

Kind regards

S Pax

Tags: Oracle Development

Similar Questions

  • How to caluclate tat between two dates of a timestamp field

    Hello
    could help to caluclate days between two dates and unique timestamp filed with this
    query
    Select * from m_activity_transaction where actn_opp_id in)
    Select actn_opp_id in the m_activity_transaction where ACTN_ACTV_ID = 218
    Actn_opp_id group
    view count (*) > 1) and ACTN_ACTV_ID = 218
    order of actn_performed_on
    IAM get output is

    ACTN_ID ACTN_OPP_ID ACTN_PERFORMED_ON
    319415 95831 JANUARY 27, 12 AM 11.06.20.000000
    315249 95831 8 FEBRUARY 12 05.32.54.000000 PM
    301927 103509 20 DECEMBER 11 04.01.43.000000 PM
    301458 103509 19 DECEMBER 11 04.51.03.000000 PM
    294841 115840 10 JANUARY 12 03.20.12.000000 PM
    312062 115840 11 JANUARY 12 05.17.06.000000 PM

    Normand to caluclate number days between two dates like January 27, 12 AM 11.06.20.000000 and I 05.32.54.000000 8 February 12 PM where actn_id is unique AND ACTN_OPP_ID IS NOT UNIQUE.
    Thanks in advance,
    VVR.

    In this way.

    with data as
    (
    select 315249 a, 95831 b, to_date('27-JAN-12 11.06.20 AM', 'DD-MON-RR HH.MI.SS AM') dt from dual union all
    select 319415, 95831, to_date('08-FEB-12 05.32.54 PM', 'DD-MON-RR HH.MI.SS AM') from dual union all
    select 301927, 103509 , to_date('20-DEC-11 04.51.03 PM', 'DD-MON-RR HH.MI.SS AM') from dual union all
    select 301458 , 103509 , to_date('19-DEC-11 04.01.43 PM', 'DD-MON-RR HH.MI.SS AM') from dual union all
    select 363810 , 144656 , to_date('27-JUN-12 12.43.28 PM', 'DD-MON-RR HH.MI.SS AM') from dual union all
    select 363500 , 144656 , to_date('26-JUN-12 11.41.50 AM', 'DD-MON-RR HH.MI.SS AM') from dual union all
    select 363354 , 144656 , to_date('25-JUN-13 12.41.13 PM', 'DD-MON-RR HH.MI.SS AM') from dual
    )
    select a, b, diff_in_days
      from (
            select a, b, trunc(dt - lag(dt) over (partition by b order by dt, a)) diff_in_days
              from data
           ) tab
     where tab.diff_in_days is not null;
    
    A                      B                      DIFF_IN_DAYS
    ---------------------- ---------------------- ----------------------
    319415                 95831                  12
    301927                 103509                 1
    363810                 144656                 1
    363354                 144656                 362
    
  • How to find directions between two locations other than my current position. I finally gave up and use Google Maps.

    In the latest version of cards, there is not apparent until you find directions between two places when or is your current position. In earlier versions, we enter in two places of departure and destination. In the new version, you enter your destination into a search window, but there is no place to enter a starting location. The application assumes that your current place of residence is always your place of departure. It is a remarkable oversight by designers. Am I missing something?

    If you go to maps, you can search for a location. Once you find the place, press the route button. It is from your current location, but if you type on my position, next: you can change the location that you want the management of.

  • How to view - (hyphen) between two dates

    My requirement is if I select the 'count' and 'to date' in the dashboard to the release of the report to display as "date-to date" could any body please help grow me in this...

    Hello

    If you want to use the strategy of Mahesh, you cannot use the BETWEEN operator. You will need for different layout columns, with a DATE data type and two presentation variables. Then, in your report, instead of saying: YOUR_DATE IS INVITED, you will need something like YOUR_DATE between @PRES_START_DATE AND @PRES_END_DATE.

    If you absolutely must use the BETWEEN condition, then you will need to define two new logical columns in your file of RPD. These two logical columns will be MIN and MAX of the column in question. When you pull these in your report, they will return the MIN and MAX date values that lie in BETWEEN your condition. You can then use the @ - @ syntax to display two dates with a hyphen.

    Hope this helps and if you need more information, do not hesitate to ask.

    Best regards

    -Joe

  • How to alternate Mondays between two dates?

    Hello

    I try to get the dates for other occurrences of a given day (say Monday) in a given range of dates.  How is it possible in a SQL query? Thanking you in advance.

    Hello

    Here's one way:

    WITH params AS

    (

    SELECT NEXT_DAY (TO_DATE (February 7, 2014 ', 'DD-Mon-YYYY') - 1).

    , 'MONDAY '.

    ) AS start_date

    , TO_DATE (31 March 2014 ', 'DD-Mon-YYYY') AS end_date

    OF the double

    )

    Start_date SELECT + ((LEVEL-1) * 14) AS a_date

    OF params

    CONNECT BY LEVEL<= ceil="" ((end_date="" +="" 1="" -="" start_date)="">

    ;

    Of course, you can easily change start_date and end_date and the day of the week target also, to all you want.

    This assumes that NLS_DATE_LANGUAGE = ENGLISH.  If you can not sure about NLS_DATE_LANGUAGE, then the same basic idea works, but the function calls are a bit messier.

    I hope that answers your question.

    Otherwise, put one or two series of the summer (start_date, end_date, day_o_week) and the desired results of each set.  Point where the above query was to produce erroneous results, and explain how to get good results in these places.

  • How to find values between two months (from January to the month prompted)?

    Hello

    I need to create a filter on the name of the month. That is to say of January of the year for the 'guest' month of guest of dashboard.

    Ex: If I ask year and month of year in 2013 and March respectively. I should get values for Jan 2013, 2013 Feb and March 2013.

    I can't try one between because that it only works on numeric values.

    I can't have a number of months in prompt because this isn't the condition and I am not allowed to.

    I tried the below query report filter

    «Sun - times» "" Fiscal month "< = (select"Dim - time". "" Fiscal month "where"Dim - time. " ("' Name of the fiscal month ' = @{PMonth}) PMonth where is the Variable of presentation" for months ".

    But it's not working

    Help, please

    Thank you

    If it is 11g then try to use the column twice.

    Thank you

    http://cool-bi.com

  • find the difference in days between two dates

    Hello world

    I'm trying to find out the difference in days between two dates and the execution of the query that I'm passing

    SELECT TO_char(sysdate, 'dd/mm/yyyy') - TO_char('15/11/2011', 'dd/mm/yyyy') DAYS FROM DUAL

    the error I get is

    ORA-01722: invalid number
    01722 00000 - "invalid number."
    * Cause:
    * Action:

    Could someone please help.

    Thanks in advance

    user10636796 wrote:
    Hello world

    Thanks a lot for all the replies. I am trying to apply it in a statement to my table like this

    SELECT trunc (sysdate) - TO_char (date_last_recommended, ' dd/mm/yyyy') DAYS OF recommendation;

    SELECT trunc (sysdate) - TRUNC (date_last_recommended) DAYS OF recommendation;

  • How to find the difference between two dates in the presentation layer

    Hi gurus,

    Hello to everyone. Today, I came with the new requirement.


    I need to know the difference between a date and the current date in the formula column application presentation layer.by.



    Thank you and best regards,
    Prates

    Hi Navin,

    TIMESTAMPDIFF function first determines the timestamp component that corresponds to the specified interval setting. For example, SQL_TSI_DAY corresponds to the day component and SQL_TSI_MONTH corresponds to the component "month".

    If you want to display the difference between two dates in days using SQL_TSI_DAY, unlike butterflies SQL_TSI_MONTH and so on...

    hope you understand...

    Award points and to close the debate, if your question is answered.

    See you soon,.
    Aravind

  • Formula to determine if a specific day of the week between two dates?

    I am creating a spreadsheet to track my time PD & holiday. I usually work weekends, and my vacation allowance includes a specific maximum number of Sundays a year. Is there a way to calculate how much Sunday fall between a date range (or any day of the week, by the way)?

    (i.e. If my vacation starts February 1, 2016 and ends March 2, 2016, Sunday how are included?)

    I know that I can calculate how many weeks have passed, using = Quotient (DateDiff (Start_Date, End_Date), 7), but it is possible to include two Sundays in a period of 7 days.

    Hi Eric,.

    Here is one approach.

    C2 = A2 + (7−WEEKDAY(A2,2))

    This concludes the first Sunday following the start date.

    D2 = STRIPDURATION ((B2−C2) ÷7)

    I formatted this column without decimal places to see full weeks of the first numbers Sunday.

    Quinn

  • Dynamic calculation of the number of days between two dates in a table

    Hello

    I'm working on request where I dynamically calculate the number of days between two dates in a table.

    The calculation must be dynamic, i.e., when I recover the Start_date and End_date and move to the field following (call_duration) in the same row, the difference must be calculated dynamically in this area and make sure the field read-only.

    APEX version: 5.0

    Hi BO123,

    BO123 wrote:

    Hello

    I'm working on request where I dynamically calculate the number of days between two dates in a table.

    The calculation must be dynamic, i.e., when I recover the Start_date and End_date and move to the field following (call_duration) in the same row, the difference must be calculated dynamically in this area and make sure the field read-only.

    APEX version: 5.0

    one of the way to do this by calling ajax on change of end_date.

    See the sample code given below to fetch the resulting duration and making the field read only after calculation

    Step 1: Change your page

    under CSS-> Inline, put the code below

    .row_item_disabled {
      cursor: default;
      opacity: 0.5;
      filter: alpha(opacity=50);
      pointer-events: none;
    }
    

    Step 2: Create on demand Ajax process I say CALC_DURATION

    Please check Procces Ajax, see line 6.7 How to assign a value to the variable sent by ajax call

    Declare
      p_start_date  date;
      p_end_date    date;
      p_duration number;
    Begin
      p_start_date  := to_date(apex_application.g_x01);
      p_end_date    := to_date(apex_application.g_x02);
    
       --do your calculation and assign the output to the variable p_duration
      select p_end_date - p_start_date into p_duration
        from dual;
    
      -- return calculated duration
      sys.htp.p(p_duration);
    End;
    

    Step 3: Create the javascript function

    Change your page-> the function and the declaration of the Global Variable-> put the javascript function

    You must extract the rowid in the first place, for which you want to set the time, see line 2

    assuming f06, f07 and f08 is the id of the start date, and end date columns respectively, and duration

    See no line no 8 how set the value returned by the process of ajax at the duration column

    Replace your column to the respective column identifiers in the code below

    function f_calulate_duration(pThis) {
      var row_id  = pThis.id.substr(4);
      var start_date = $('#f06_'+row_id).val();
      apex.server.process ( "CALC_DURATION", {
      x01: start_date,x02: $(pThis).val()
    }, { success: function( pData ) {
    // set duration to duration column
    $('#f08_'+row_id).val(pData);
    // disable duration column
    $("#f08_" + row_id).attr("readonly", true).addClass('row_item_disabled'); }
    });
    }
    

    Step 4: choose the end date call the javascript function

    Go to report attributes-> edit your Date column end-> column-> Attrbiutes element attributes-> put the code below

    onchange="javascript:f_calulate_duration(this);"
    


    hope this helps you,

    Kind regards

    Jitendra

  • JavaScript anomaly on the number of days between two dates

    Use ApEx 4.0, I found an anomaly in a javascript code that calculates the number of days between two dates, the current_date and the past_date. If the past and present is the or before March 10, 2013, and the current_date lies between 10 March 2013 and November 3, 2013, the number of days will be from 1 day to less than the actual number. Between November 3, 2013 and on 4 November 2013, the increments of number by 2, then the count will be accurate from this date forward.

    Here are some examples:

    March 10, 2013 = 69 days of December 31, 2012
    March 11, 2013 = 69 days of December 31, 2012
    March 12, 2013 = 70 days of December 31, 2012

    November 3, 2013 = 306 days in December 31, 2012
    November 4, 2013 = 308 days in December 31, 2012

    11 March should be 70 and 12 March should be 71. November 3 is 307 and 4 November corrects the number of fake, which began March 11.

    Change the past_date to March 10, 2013 produces the following:

    March 10, 2013 = 0 days of March 10, 2013
    March 11, 2013 = 0 days of March 10, 2013
    March 12, 2013 = 1 days of March 10, 2013

    But change the past_date to 11 March 2013, product of the correct numbers:

    March 11, 2013 = 0 days of March 11, 2013
    March 12, 2013 = 1 days of March 11, 2013
    March 13, 2013 = 2 days of March 11, 2013

    I would certainly all help to determine the cause of this anomaly. Here's the javascript code:

    var w1 = ($v ("P48_PAST_DATE"));
    W1 = (w1.toString ());
    vmon var = (w1.substr (3.3));
    vyr var = (w1.substr (7));
    var r = (vyr.length);
    If (r == 2)
    vyr. = (parseFloat (vyr) + 2000);
    vday var = (w1.substr (0.2));
    var y = (vmon.concat ("", vday, ",", vyr));
    y = Date.parse (y);

    var w2 = ($v ("P48_CURRENT_DATE"));
    var vmon2 = (w2.substr (3.3));
    var vyr2 = (w2.substr (7));
    var vday2 = (w2.substr (0.2));
    var x = (vmon2.concat ("", vday2, ",", vyr2));
    x = Date.parse (x);

    var numdays = (x - y);
    numdays = (Math.floor(numdays / 86400000));
    $s ("P48_NUMBEROFDAYS", numdays);

    Did you google for something like "javascript number of days between two dates. I think you will find the explanation to this observation:

    This method does not work correctly if there is an advanced economies jump between the two dates.

    There are examples available to calculate the difference between two dates.

  • Calculate the difference in days between two Dates

    Hello

    I'm trying to understand how to calculate the difference in days between two dates using JavaScript in LiveCycle. (Minimum = JavaScript knowledge)

    Where 'Start_Date' and 'Current_Date' are the names of the two dates in the palette of the hierarchy. (the two Date/time field)

    * Current date is using the object > value > execution property > current Date/time

    I need a text or number field showing the difference in days. (Difference_in_Days)

    I noticed the following code is pretty standard among other responses:

    var

    Start_date = new Date (Start_Date);

    var

    Current_Date = new Date (Current_Date);

    var

    nAgeMilliseconds = Current_Date.getTime) - Start_date.getTime ();

    var

    nMilliSecondsPerYear = 365 * 24 * 60 * 60 * 1000 ;

    I know there is lack of code and code above are may not be not correct.

    Please notify.

    OK, that's because of the way that javascript and works of the calculate event.  The field will be filled with whatever the script resolves at the end of execution. Technically, your script does not have a value because the last thing you do is an assignment to a variable.  Change the last line as follows:

    Math.ABS ((firstDate.getTime)

    ((- secondDate.getTime (()) / (oneDay));

    (eliminate the variable assignment) and get rid of the app.alert.  Your script will "return" (have) regardless of the value of calculation from the East and which will be stored in the field.

  • Find the difference between two date and time

    Hi friends,

    I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."

    select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed  
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate) 
    order by sql_step_num;

    You try to get the feel between two char strings.
    And more difference between two dates gives a NUMBER of days.
    Try this:

    select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate)
    order by sql_step_num;
    
  • difference between two dates in the year/month/day in Obiee

    Hi gurus,

    I know this question have been asked and answered several times but I have a requirement that is a little different, then the previous ones.

    I want to calculate the difference between two dates in OBIEE10g in year/month/day format similar to the below SQL output

    SQL > select end_date, start_date,

    trunc (months_between (end_date, start_date) / 12) years.

    months of mod (trunc (months_between (end_date, start_date)), 12).

    End_date - add_months (start_date, trunc (months_between (end_date, start_date))) days

    t

    Thanks in advance

    SK

    Search for this

    "TIMESTAMPDIFF IN THE FORM OF MTHS # YEARS."

    or else

    To get the current mandate of employees since the date of hiring in the form of # years # mths or # year (s) # month (s)

    Concat (concat (cast (TIMESTAMPDIFF (SQL_TSI_Month, "Employee attributes". (((' ' Hiring last Date employee ", CURRENT_DATE) / 12 as char),"Year (s)"), concat (cast (MOD (TIMESTAMPDIFF (SQL_TSI_Month,"Employee attributes". (((((' ' Hiring last Date employee ", CURRENT_DATE), 12) as char), 'Month (s)'))

    Concat (concat (CAST (TIMESTAMPDIFF (SQL_TSI_YEAR, "Employee attributes". (((' ' Hiring last Date employee ", CURRENT_DATE) as CHAR),"Year (s)"), concat (cast (MOD (TIMESTAMPDIFF (SQL_TSI_Month,"Employee attributes". (((((' ' Hiring last Date employee ", CURRENT_DATE), 12) as char), 'Mth (s)'))

  • Days between two dates given

    Hi all

    I need the days between two dates given.

    Select to_date('25-mar-2014','dd-mon-yyyy') start_date, end_date to_date('30-mar-2014','dd-mon-yyyy')

    of the double

    Desired output:

    25

    26

    27

    28

    29

    30

    Thanks in advance.

    Kind regards

    Afzal.

    Select the level - 1 desired_output + to_number (to_char (start_date, 'dd'))

    of (to_date('25-mar-2014','dd-mon-yyyy') select start_date, end_date to_date('30-mar-2014','dd-mon-yyyy'))

    of the double

    )

    connect by level<=  end_date="" -="" start_date="" +="">

    DESIRED_OUTPUT
    25
    26
    27
    28
    29
    30

    Concerning

    Etbin

Maybe you are looking for

  • Problems using the event to write new parameter values to VISA structure

    Hi all I created a VI to read an Omega flow meter. It is possible to change setpoint (setpoint (0-2) SLPM) of the meter and the gas (O2, CH4,...). To read instrument I write its ID (A-Z), followed by a carriage return, for example: A + 0x0D I created

  • Table 2D-search

    Hi, I'm fairly new to Labview and I have this problem: I am in a position sensitivity of radio link to microwave with the attenuator of voltage controlled od aif. First of all, I do calibration attenuator itself, if I get the file .csv with two colum

  • missing winusb.dll

    I try to install the program "Tether" in order to connect my Vaio laptop to my smartphone.  I have all the drivers installed for my LG smartphone.  "Home" program is installed, but when I try to open the program a message appears ' this application h

  • Updated WT19i to ICS in Ukraine?

    Will update SE LWW to ICS in the region of the Ukraine?Not very pleasant when there firmware official, but you can not pass because of his tovego of the region not out...

  • BlackBerry Smartphones is hotmail supported?

    Hotmail is supported on Blackberry? Thank you