Days between 2 dates...

I had a date last night and another one on Friday... but I'm not sure what to do in the time between. Can someone give me code to occupy my time?

if (rent.porn(true)) {
    while (sleep(false)) {
        self.please();
}

Similar Messages

  • How to count the days between Date Range using OO ABAP?

    hi experts,
            i want to count the days between Date Range using OO ABAP for that  which class and method  can i use?.
    Thanks,
    Mahesh.

    Not sure I understand the requirement for it to be OO, but you could always write your own (i.e. use this):
    REPORT zz_date_diff.
    CLASS date_diff DEFINITION.
      PUBLIC SECTION.
        METHODS diff IMPORTING     i_date_fm TYPE d
                                   i_date_to TYPE d
                     EXPORTING     e_days    TYPE i.
    ENDCLASS."
    CLASS date_diff IMPLEMENTATION.
      METHOD diff.
        e_days = i_date_to - i_date_fm.
      ENDMETHOD."
    ENDCLASS."
    DATA: g_ref TYPE REF TO date_diff,
          g_days  TYPE i,
          g_date_fm  TYPE d VALUE '20080101',
          g_date_to  TYPE d VALUE '20090101'.
    START-OF-SELECTION.
      CREATE OBJECT g_ref.
      CALL METHOD g_ref->diff
        EXPORTING
          i_date_fm = g_date_fm
          i_date_to = g_date_to
        IMPORTING
          e_days    = g_days.
      WRITE g_days.

  • Find no. of days between dates

    Hi guys,
    I have 5 dates with me, 2 of which are Key Figures and 3 are of Char. date type. Now, I have to find no. of days between these dates using various permutation and combination i.e. it can be between 2 KF's or 2 Char. types or 1 KF and 1 Char. type as well.
    1) I think finding no. of days between 2 KFs can be done using Cumulative KF.
    2) I tried to find no. of days between 2 Charac. by creating a Formula (2 variables with Replacement Path) and then finding the difference. But the output seems to be wrong.
    eg. 27.02.2009     -    19.01.2009  = 108 days, which is wrong!
         (Posting date)      (clearing date)
    3) I also have to do it between 1 KF and 1 Char. date type, tried creating 1 variable for Char. and then subtracting with KF, but Report shows 'X' in the output!
    Any suggestions?
    Thanks.

    Hi,
    You can do it by using Customer Exits and Replacement path Variables..
    see teh floowing thread.
    Difference in days
    Thanks
    Reddy

  • Find year,month & day between dates

    Hi,
       I need to find a number of years, months & day between a given dates. For example If a employee joined on 31.01.2003 and left on 01.06.2006, I need to find in between how many years, months & days he has worked. Is there any function module available .

    DATA: EDAYS LIKE VTBBEWE-ATAGE,
    EMONTHS LIKE VTBBEWE-ATAGE,
    EYEARS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
    TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    Call Function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
    *   I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Using teh abiove u can get difference but when u pass previous year u wont get the exact.
    There is no seperate FM for this, u have to use three FM.
    If possible using these three FM code u can create an FM.
    <b>For years and months between two days:</b>
    DATA:   EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE PREL-BEGDA,
                     TODATE   LIKE PREL-BEGDA DEFAULT SY-DATUM.
    CALL FUNCTION 'COMPUTE_YEARS_BETWEEN_DATES'
      EXPORTING
        first_date                        = fromdate
    *   MODIFY_INTERVAL                   = ' '
        second_date                       = todate
    IMPORTING
       YEARS_BETWEEN_DATES               =  EYEARS
    * EXCEPTIONS
    *   SEQUENCE_OF_DATES_NOT_VALID       = 1
    *   OTHERS                            = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Write:/ eyears.
    DATA:       EMONTHS LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE SY-DATUM,
                TODATE   LIKE SY-DATUM
    DEFAULT SY-DATUM.
    CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_bis         = fromdate
        i_datum_von         = todate
    *   I_KZ_INCL_BIS       = ' '
    IMPORTING
       E_MONATE            = emonths
    write:/ emonths
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
    EXPORTING
    I_DATUM_BIS = x_faede-zfbdt
    I_DATUM_VON = p_fdat
    I_KZ_EXCL_VON = '0'
    I_KZ_INCL_BIS = '0'
    I_KZ_ULT_BIS = ' '
    I_KZ_ULT_VON = ' '
    I_STGMETH = '0'
    I_SZBMETH = '1'
    IMPORTING
    E_TAGE = dias_v.
    IF SY-SUBRC <> 0.
    ENDIF.
    x_faede-zfbdt -> 20050915
    p_fdat -> 20050811
    dias_v = 4
    try this and let me know.
    Message was edited by:
            Judith Jessie Selvi

  • Months and days between dates

    What is the formula to find the months and days between dates

    Tricky... The first problem is the intended result. Months have a varying number of days in them, days and weeks have set values. For example the difference between 1st July and 1st September is 2 months but this does not give an accurate count of the number of days (61).
    It would be better to calculate the number of days difference and forget the months.
    You would need a lookup table showing a numeric value for each date that would show each date with a day value from a starting point. If your earliest date is 01/01/2000 then that would be day zero. Then using the lookup table calculate the day value for your beginning and end dates. Subtract one from the other to get the number of days.
    If all your dates are from this year:
    You can create your own Cell Format (call it day of the year) Select the Type: Date & Time
    drag the icon for Day of Year into the box and delete the others.
    Convert your dates to this new Format, subtract one value from the other to get the number of days difference.

  • Confused - How to Calculate Number of Days Between Dates but Exclude Weekend Dates If There Hasn't Been a Weekend Update

    Hello -
    I've been tearing my hair out over this problem i'm trying to solve, probably just been staring at it too long which is making it worse -
    I have a series of open support tickets which are supposed to be updated on a daily basis, the problem is that they aren't always being updated daily.  So, the business wants to know the number of days from when a ticket was last updated and today's
    date.  I have this basic calculation and it's working fine, however now the business wants to exclude weekends from the calculation.  The other problem is that some reps DO go in on weekends and update their tickets, so sometimes there will be updates
    made on weekend dates.
    To give an example -
    Today's date is 2014-02-10 (Monday).  A ticket was last updated last Thursday, 2014-01-30.  The difference between the two dates is 11, so it's been 11 days since the ticket was last updated.  Now, if I exclude Saturdays and Sundays, then
    it's actually been 7 days since the ticket was last updated.  I'm not sure how to do this in T-SQL.
    Now, to further complicate the problem, sometimes a ticket IS updated on a Saturday or Sunday.  So, if a ticket was updated on 2014-02-02 (Sunday), then it should be counted.  Again i'm not sure how to do this. 
    What gets me is that this is probably fairly simple and i've just been staring at it too long.  In the meantime, can someone offer some guidance?
    Thanks!!

    I've adapted this from a function on my blog. you will need to add set the YourTicketTable to where ever your tickets are stored.
    CREATE
    FUNCTION [dbo].[CalcWorkDaysBetween](@StartDate
    As DateTime,@EndDate
    AS DateTime)
    RETURNS
    INT AS
    BEGIN
    SET @EndDate
    =DATEADD(DAY,1,@EndDate)
    DECLARE @Count
    AS Int= 0
    DECLARE @Date
    As Date=@StartDate
    WHILE @Date
    < @EndDate
    BEGIN
    IF (DATEPART(WEEKDAY,@Date)IN(1,7)
    OR (SELECT
    Count(*)
    FROM YourTicketTable WHERE TicketDate=@Date)=1)
    BEGIN
    SELECT @Count = @Count
    + 1
    END
    SELECT @Date=DATEADD(Day,
    1,@Date)
    END
    RETURN
    DATEDIFF(DAY,@StartDate,@EndDate)- @Count
    END
    Regards,

  • Using Formcalc to calculate Days between Dates

    Can anyone give me a simple FormCalc script in which an end date is subtracted from a start date and the result is expressed in number of days?  I'm using LiveCycle Designer ES (not ES2).  Thank you!

    Use the following FormCalc script:
    var numDays;
    numDays = Date2Num("21/5/2012", "DD/M/YYYY") - Date2Num("19/5/2012", "DD/M/YYYY");
    For more details on FormCalc scripting, pelase refer to: http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf

  • Using average days between dates to predict a launch date on another produc

    I hope someone might be able to help me out here.
    I am at the limit of my Webi expertise! (which is not saying a lot)
    We have a universe containing date information relating to the launch of products thus:
    Product Name
    Supplier Name
    Category
    Sample Availability Date
    Testing Start Date
    Launch Go Date
    It is a simple matter to create a variable u2018Project Timeu2019 as DaysBetween(Testing Start Date;Launch Go Date)
    And using the Average function we can create Average Project Length - Also with the Report, and Section keywords we can show the global average, and averages by Supplier and Category.
    Here is my problem.
    We also have Products in the universe that have yet to have their projects kicked off, so Testing Start Date and Launch Go Date for those products are null data. I want to use the Sample Availability Date and the Average Project Length variable to predict the probable Launch Go date, however, in the report this element shows up as an empty cell.
    Does anyone have an idea how I might achieve this?
    Many Thanks
    Mark

    OK...
    Lets imagine there are records for 100 devices in the universe.  75 of them have valid project start dates and launch dates.  25 of them have neither because those projects are yet to start.  However they do have a sample availability date.
    Using the DaysBetween function I can create a variable called project length from the start and launch dates.  I can then use the Average function to get the average project length (for the devices that actually have a project length)
    Somehow I want to add this average project length to the sample availability date on the records that have yet to have a start date.
    As projects end they will add to the average, and we can see how close they were to the predicted launch. As new records are added they will automatically have a predicted date.
    Right now I have the average project length, If I create a table filtering on completed projects (Projects with a non-null launch date) and I add a column showing average project length, because I've used the In Report keyword on the average, it shows the average value in this table.
    If I have a stand-alone cell with the average project length it shows the right value
    But if I have a table showing the devices yet to start (filtering on Null start date) If I add the average project length into that table it shows as blank (I.e. no value at all)
    Hope this helps

  • How to get difference in days between 2 dates excluding weekends

    Hi all,
    i have a requirement, to calculate the difference between 2 dates, in days.
    eg: 01/08/2007 and 05/08/2007.
         Difference = 4 days.
    But here my actual requirement is i have to calculate this difference excluding weekends (saturday n sundays).
    eg: 01/08/2007 -
    Thursday
         05/08/2007 -
    Monday
    so now Difference = 2 days.
    Please help me regarding this.
    Points will be rewarded for helpfull answers.
    Thanks in Advance.
    Regards,
    Vineel

    see these codes of rich
    report zrich_0003.
    data: begin of itab occurs 0,
          datum type sy-datum,
          end of itab.
    data: weekday like dtresr-weekday.
    data: number_lines type i.
    parameters: p_sdatum type sy-datum,
                p_edatum type sy-datum.
    itab-datum = p_sdatum.
    append itab.
    do.
      if itab-datum = p_edatum.
        exit.
      endif.
      itab-datum = itab-datum + 1.
      call function 'DATE_TO_DAY'
           exporting
                date    = itab-datum
           importing
                weekday = weekday.
      if weekday = 'Sat.'
        or weekday = 'Sunday'.
        continue.
      endif.
      append itab.
    enddo.
    describe table itab lines number_lines.
    write:/ 'Number of days between dates is', number_lines.
    and
    report zrich_0001.
    parameters: p_start type sy-datum,
                p_end   type sy-datum.
    data: idays type table of   rke_dat with header line.
    data: workingdays type i.
    call function 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
         exporting
              i_datab               = p_start
              i_datbi               = p_end
              i_factid              = 'P8'  " Fact Calender ID
         tables
              eth_dats              = idays
         exceptions
              date_conversion_error = 1
              others                = 2.
    describe table idays lines workingdays.
    write:/ workingdays.
    I want to find the No.of working days between the two dates
    regards,
    srinivas

  • Query for difference between dates

    I know I can use the DATEDIFF
    How can I write it if StartDate and EndDate are in these formats?
    StartDate: 2006-09-20 00:00:00.000
    EndDate:   2013-09-20 18:20:53.000
    I want to find the number of days between dates of dates in the two columns

    Those work great, What if I want to use values from a table?
    I have a column called StartDate and a column called EndDate with dates in it. I just what it to show the StartDate in a column, the Endate in column and the number of days in a column.
    Hi,
    Based on your description, do you want to display the following result?
    USE <DatabaseName>
    GO
    --Create a table named DateTest
    CREATE TABLE DateTest
    (StartDate datetime,
    EndDate datetime
    INSERT INTO DateTest
    VALUES ('2006-09-20 00:00:00.000','2013-09-20 18:20:53.000'),
    ('2007-05-06 12:10:09.000','2008-05-07 12:10:09.000'),
    ('2007-05-07 09:53:01.000','2009-05-08 09:53:01.000'),
    ('2008-08-07 05:53:01.000','2010-08-08 05:53:01.000')
    -- Create another table named DateTest1
    SELECT DateTest.StartDate, DateTest.EndDate,
    DATEDIFF(DAY,DateTest.StartDate,DateTest.EndDate) AS days_number INTO DateTest1
    FROM DateTest
    SELECT *FROM DateTest1
    --Below is the result
    StartDate EndDate days_number
    2006-09-20 00:00:00.000 2013-09-20 18:20:53.000 2557
    2007-05-06 12:10:09.000 2008-05-07 12:10:09.000 367
    2007-05-07 09:53:01.000 2009-05-08 09:53:01.000 732
    2008-08-07 05:53:01.000 2010-08-08 05:53:01.000 731
    Thanks,
    Lydia Zhang

  • Working days between two date fields and Changing Factory Calendar

    Hi,
    I have to calculate working days between two date fields excluding the weekends and public holidays for Switzerland.
    I have written the routine using factory calender and its working fine except for two problems now:
    1. If any one of the date field is empty then teh rsult should be zero.
    2. And the below code is working from 1996 but my cleints wants it to work for years before 1996 as well.
    I also tried to change the Start date in SCAL for factory calendar but it says enter values between 1995 to 2020.
    I am new to ABAP. Please help me how i can achieve these for below code.
    DATA: IT_HOLIDAYS type TABLE OF ISCAL_DAY,
          IS_HOLIDAYS TYPE ISCAL_DAY.
    DATA: T_DATE TYPE SY-DATUM,
          P_DATE TYPE SY-DATUM.
    DATA : X_DATE(4) TYPE C.
    DATA: CNT TYPE I.
    REFRESH : IT_HOLIDAYS.
    CLEAR : IT_HOLIDAYS.
    T_DATE = SOURCE_FIELDS-/BIC/ZCCCHP812.
    P_DATE = SOURCE_FIELDS-/BIC/ZCCCHP810.
    CALL FUNCTION 'HOLIDAY_GET'
    EXPORTING
    HOLIDAY_CALENDAR = 'CH'
    FACTORY_CALENDAR = 'CH'
    DATE_FROM = P_DATE
    DATE_TO   = T_DATE
    TABLES
    HOLIDAYS = IT_HOLIDAYS
    EXCEPTIONS
    FACTORY_CALENDAR_NOT_FOUND = 1
    HOLIDAY_CALENDAR_NOT_FOUND = 2
    DATE_HAS_INVALID_FORMAT = 3
    DATE_INCONSISTENCY = 4
    OTHERS = 5.
    DESCRIBE TABLE IT_HOLIDAYS LINES CNT.
    X_DATE = T_DATE - P_DATE - CNT.
    RESULT = X_DATE.
    Please help
    Regards
    Zabina
    Edited by: Syed786 on Nov 2, 2011 9:15 AM

    Hi Zabina,
    Try this function module  'DURATION_DETERMINE'.
    Give the factory calendar and unit as DAY
    With regards,
    Rajesh

  • Query on fetching the no.of days between Invoice date and due date in rtf template embedded BI Publisher Report

    Hi Experts,
    We have a requirement to fetch the value of 'No of days' between Invoice date and due date (Two variable date fields on the template) in an Analysis.
    Please let me know the procedure of how to achieve the same.
    Regards,
    Rev

    it's good for ideas but implementation a bit different
    Oracle Business Intelligence Publisher Report Designer's Guide
    This function provides a method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only the Gregorian calendar. The syntax is as follows:
    <?xdoxslt:date_diff(‘format’, ‘YYYY-MM-DD’, ‘YYYY-MM-DD’, $_XDOLOCALE, $_XDOTIMEZONE)?>
    where
    format is the time value for which the difference is to be calculated
    Example:
    <?xdoxslt:date_diff(‘d’, ‘2006-04-08’, ‘2006-04-01’, $_XDOLOCALE, ‘America/Los_Angeles’)?>
    returns
    -7

  • Calculate Days between same date field in multiple records, looping for each record

    Be patient as I am a newbie to Sql Server (using 2008 R2) and SSIS.  I have looked at multiple solutions in this and many other forums before submitting the question.
    I am looking at records to identify the number of days between two dates.  We review drug information.  A member uses drug A (Code identifies this called GPI) and has refills throughout time.  The goal is to calculate the days between Refill
    1 and refill 2, then refill 2 to refill 3, etc.  When that member record set is complete, we move to the next member record set.
    The basic data would be as follows.  Each record shown below would be a separate record in a single table :
    Member
    Drug Code
          DateService
             Days Between
    1
    A
    3/1/2012
    0
    1
    A
    3/27/2012
    27
    1
    A
    4/21/2012
    26
    1
    A
    6/15/2012
    56
    1
    F
    2/25/2012
    0
    1
    F
    3/20/2012
    25
    1
    F
    4/17/2012
    29
    1
    F
    8/1/2012
    107
    5
    B
    2/15/2012
    0
    5
    B
    3/10/2012
    25
    5
    B
    4/10/2012
    32
    5
    B
    6/28/2012
    80
    5
    B
    7/10/2012
    13
    5
    B
    8/20/2012
    42
    The days between is the value I am looking to calculate.  The First record for the grouping of Member and Drug Code will be zero ( 0 ) as there is no preceding date to calculate against.  The process would then loop through the records at the grouping
    (Member and Drug Code) until those records are calculated.  It would then move on to the next group of Member/Drug records.
    Any assistance would be greatly appreciated.  Any clarification I can provide, I would be more than happpy too.  Thank you in advance!

    TSQL- Finding the difference in days of multiple records in SQL ServerWITH OrderDates AS (
    SELECT
    ROW_NUMBER() OVER (ORDER BY OrderDate DESC) AS RowNumber,
    OrderDate
    FROM OrdersTable
    WHERE SKU = 'AA0000'
    SELECT
    AVG(DATEDIFF(DD, O2.OrderDate, O1.OrderDate)) AS AverageFrequency
    FROM OrderDates O1
    LEFT JOIN OrderDates O2
    ON O2.RowNumber = O1.RowNumber + 1
    Fabio Bilicki

  • How to calculate the days between last movement of material till today date

    Hello Experts,
    Could someone help me please?
    I have a key figure in the InfoCube 0IC_C03 witch contain the last date of movement of material.
    (it is a key figure created in format date and contain the max value).
    How can I to calculate the number of days between this date (last movement),  till today date (system date).
    I need to show:
    material........last movement.....days without movements.
    xxxxxxxxxxx.....dd/mm/yyyy..........9999
    Im trying to do this calculation in bex using variable formula but it doesn't work becouse current date (customer exit) brings sy-datum in format yyyymmdd and the kf-last-mov is in format number (I dont know what kind of number)
    Thanks in advance,
    Points are assured.
    Regards,
    Silvio Meurer.
    Message was edited by:
            Silvio Meurer

    Hi Parth,
    Here we are using the version 7.0 and SP 10, I'm afraid I could not understand you. I Can't find the function DATE_DIFF (Where is it?)
    I'm using the formula and it doesn't work. Coud you see the result is:
    last movement date     Today date        result
    02.04.2007                  20.070.625       19.337.856
    18.05.2007                  20.070.625       19.337.810
    the "today date" is from customer exit and the result is a strange number to me.
    Could you help me?

  • Function module to calculate no of days between two date ranges

    hi experts,
    can some one please suggest a function module that can calculate no of days between specified date range.
    for example : if i enter date range between 26.02.2011 to 20.05.2011, then it should calculate no of days between these dates.
    Moderator message : Basic date questions not allowed. Read forum rules before posting. Thread locked.
    Edited by: Vinod Kumar on May 25, 2011 10:57 AM

    Hi,
    Please search SDN.. there are lots of posts for teh same.
    [http://wiki.sdn.sap.com/wiki/display/ABAP/FunctionModulerelatedonDate+calculations]

  • How to calculate days between 2 dates excluding public holidays over SAP ?

    Hi
    Have a universe over SAP data. Trying to calculate days between 2 dates. SAP holds Public Holiday data in various tables e.g  Thol and data is updated via scal. Using my univeres as a source I want to run  reports for different countries so need to have various bank holidays not just UK. In SAP function modules handle this. Has anyone designed a solution to cater for this situation in a universe ?
    Thanks in advance
    M

    Hi,
    I assume you mean SAP R/3 (ECC) when you write SAP and SAP BW.
    Are you using BW? If so, I would load the data into SAP BW, create a query using customer exit variables and build your universe on top of that...
    -J

Maybe you are looking for

  • HT3798 Ipod Classic will not sync with windows 8 and newest itunes

    I have ipod classic, 160gb, with new computer with Windows 8 and latest version of Itunes - came from xp and previous version of itunes - and never had a syncing problem.  All my songs are in new itunes on new computer, however ipod will not sync.  H

  • Create contact person for a Vendor

    Hi experts Someone could explaim the processes of contact person creation. I replicated the vendor from R/3 and now I need to send a BId to this vendor but the sistem ask for a contact person, so I tried go to transaction Manage business  Partner - E

  • Flash MX 2004 Professional V7.2

    Can anyone assist - I have Flash MX 2004 Professional V7.2 but do not seem able to find the Active Content Update Extension for this version. The downloads available seem to be for V7.0 or Flash 8. Regards, Dawn.

  • Png file displayed on web has very bad resolution

    But on my Mac it is sharp. It was a pdf in Acrobat "Saved as..." a png. Very frustrating problem begs for solution. Thanks in advance.

  • CKMLCP  Material ledger closing

    Hi, We are doing closing entries for material ledter. After executing all the steps, when we are checking the detail of materials in VIEW of CKMLCP, it looks for some of the material the Closing entry doesn't took plance All the other activities like