Determine the number of days in a False period in a Temporal Boolean

Hi all,
I need to determiine the number of days based on a condition that lies on the gaps between the periods.
My input consists of multiple periods. The length of the gap is the condition to determine the start date for summation. However, there can be multimple gaps between my instances that satisfy this condition and I need the last one that satisfies it.
For example:
period 1: 1-1-1990 until 31-12-1992
period 2: 1-1-1994 until 31-12-1996
period 3: 1-1-1998 until 31-12-1999
period 4: 1-6-2000 until 31-12-2009
The condition for the start date is the last gap greater than 1 year. In this example, the start date should be the start date of period 3: 1-1-1998, because this is the period after the last gap >= 1 year. Period 2 also has a previous gap of >= 1 year, but this period should NOT be selected.
My first idea was to use a TBR function: to determine relevant periods (based on the gaps before and after), calculate the amount of days per relevant period and add those up. However, if I want to do that I need to calculate the number of days in the gaps and I don't see how to do that, since I cannot determine a day difference across periods (end date period 1 until start date period 2).
Any help/ other solution ideas?
Kind regards, Els

This was an interesting puzzle which you can solve from a couple of different angles.
Firstly, you can use inferred relationships to infer a relationship "the following periods" (ie. the periods that follow the current one). My rules looked like this:
the period (the other period) is a member of the following periods if
   the other period start date > the period start date
the period’s next start date = InstanceMinimum(the following periods, the period start date)From here it should be easy to see if there was a gap of more than a year, and find the most recent period after a year-long gap. Of course you need to deal with the situation of the last period, when there is no 'next' period, presumably you would use the date of assessment in that case, but I'll leave that as an exercise for the reader.
A completely different way of doing it is to use the TemporalConsecutiveDays function to find a date where a gap of 365 days exists, then select periods in which there is a gap immediately before the start of that period. Here are some rules that :
there is a period that applies if
   ExistsScope(the periods)
      TemporalOnOrAfter(the period start date) and
      TemporalOnOrBefore(the period end date)
there is a year-long gap if
   TemporalConsecutiveDays(365, 365, there is not a period that applies)
the period starts after a year-long gap if
   ValueAt(the period start date, there is a year-long gap)
the start date for calculation = InstanceMaximumIf(the periods, the period start date, the period starts after a year-long gap)Hopefully one of these is suitable for your needs.
cheers,
Steve.

Similar Messages

  • Calculate the number of days in a month

    I need to do a calculation in my query based upon the number of days in the month. The report is broken down by cal year / month.
    Is there an easy way of identifying these values in the query?
    Regards.

    Hi,
      This can be done by writing an user exit code to determine the number of days in the month.
    Sample Code :
    <
    CHECK i_step = 2.
      READ TABLE i_t_var_range WITH KEY vnam = 'XXXX'
                               INTO loc_var_range.
      IF sy-subrc EQ 0.
        beg_date(6) = loc_var_range-low(6).
        end_date(6) = loc_var_range-low(6).
        beg_date+6(2) = '01'.
        end_date+6(2) = '01'.
        ADD 1 TO end_date+4(2).
        IF end_date+4(2) = '13'.
          end_date+4(2) = '01'.
          ADD 1 TO end_date(4).
        ENDIF.
        no_days = end_date - beg_date.
        l_s_range-sign = 'I'.
        l_s_range-opt  = 'EQ'.
        l_s_range-low  = no_days.
        APPEND l_s_range TO e_t_range.
      ENDIF.
    >
    Hope this helps..
    Thanks & Regards,
    Pradeep

  • How to determine the number of pixels of a desired object within a digital photograph?

    Hi everyone. I want to determine the number of pixels in an object that is part of a digital photo. I use cameras to film chunks of ice breaking away from ice cliffs or tidewater glaciers. I want to know the size of the ice chunk that my digital photographs capture. I know the width and height of the ice cliff in metres already, so I was thinking that I could convert the equivalent of 1 pixel : ? metres - this is really what I want to do. That way every time I see a chunk of ice breaking off, I can pull up the photo, outline the chunk, calculate how many pixels fill the area of ice removed by the chunk breaking off and convert to metres area 2 - thus giving me my size order. If anyone has ideas on how to do this I would really appreciate it, thanks so much community. I was thinking that Photoshop or Fireworks could help me with this, Ricky

    Thanks gener7 and normfb.
    The Photoshop help measurement page is brilliant and I think I can use the info on that page to work out my iceberg sizes. Check out the attached photo - you are looking at an ice cliff - essentially the front of a tidewater glacier that flows in the ocean. I'm a research student and I look at the process of iceberg calving - this is the term we use to define the sudden breaking away or detachment of ice chunks from glaciers that end in the sea.
    I used the lasso tool to crop the area of ice lost as a single chunk of ice detached from the ice cliff. At the same time I had the histogram window open. The histogram showed me how many pixels were contained in the cropped area. What I need to do now is work out what 1 pixel is equivalent to in metres. Soon I will have a digital elevation model for the ice cliff that will offer centimetre to metre scale resolution of the surface topography - so that should really help. The photographs I have are taken every 30 seconds - which is brilliant for documenting how the geometry of the ice cliff adjusts in response to detaching ice pieces and also because the ice is moving. I am a research student in Canada, and at the time I took the photos we measured that the ice cliff was advancing at a rate of approximately 12 metres per day! That's pretty fast. The flow of the ice is a first order control on the rate of iceberg production - you are essentially pushing ice into the ocean where it breaks off. I'm having to learn everything Photoshop from scratch...so please bare with me because maybe some of the photoshop questions I ask are simple to most!
    I noticed the "integrated density" function on the help sheet you suggested. This function also provides the square number of pixels contained in the cropped area I select...I guess this is similar to the histogram right?
    Either way - i just need the scale conversion to go from 1 pixel : metres or cm equivalent. At that point I think I will have to manually select every single iceberg event from my time-lapse photos and do this the manual way!  I have about 800 events to manually digitise and calculate the area for...
    Thanks everyone, Ricky

  • Run a query that will determine the number of parts to produce

    I have the task that I have to determine the number of parts that need to be produced based on the number of products sold for the day (each product consists of many parts).
    I am using SQL 11g Express.
    I have stared at this for so long and tried so many different ways. Below are a few of what I have tried, with the error messages. I'm not sure where I'm going wrong to get this calculation. Any help here is greatly appreciated!
    Here's my info:
    /**PRODUCT**/
    CREATE table Product
        SKU       VARCHAR2(10) NOT NULL,
        ProdDesc   VARCHAR2(50) NOT NULL,
        Price      NUMBER(5,2),
        PRIMARY KEY(SKU)
    /**PART**/
    CREATE table Part
        PartID     NUMBER(6) NOT NULL,
        PartDesc   VARCHAR2(50) NOT NULL,
        PRIMARY KEY(PartID)
    /**PRODUCTPART**/
    CREATE table ProductPart
        SKU        VARCHAR2(10) NOT NULL CONSTRAINT fk_ProductPart_Product REFERENCES Product (SKU),
        PartID     NUMBER(6) NOT NULL CONSTRAINT fk_ProductPart_Part REFERENCES Part (PartID),
        NumOfParts NUMBER(3),
        CONSTRAINT pk_ProductPart PRIMARY KEY (SKU, PartID)
    CREATE table Customer
        CustID     NUMBER(6) NOT NULL,
        CustFname  VARCHAR2(20) NOT NULL,
        CustLname  VARCHAR2(20) NOT NULL,
        Company    VARCHAR2(40),
        Address    VARCHAR2(40) NOT NULL,
        City       VARCHAR2(30)NOT NULL,
        State      VARCHAR2(2)NOT NULL,
        Zip        NUMBER(5)NOT NULL,
        Phone      NUMBER(10)NOT NULL,
        PRIMARY KEY (CustID)
    CREATE table CustOrder
        OrderID    NUMBER(6) NOT NULL,
        Qty        NUMBER(3) NOT NULL,
        OrderDate  Date NOT NULL,
        SKU        VARCHAR(10) NOT NULL CONSTRAINT fk_CustOrder_Product REFERENCES Product (SKU),
        CustID     Number(6) NOT NULL CONSTRAINT fk_CustOrder_Customer REFERENCES Customer (CustID),
        PRIMARY KEY (OrderID)
    Here are some of the queries:
    SELECT ProductPart.Qty
    SELECT CustOrder.SKU,
    sum(CustOrder.qty)
    FROM CustOrder
        GROUP BY CustOrder.SKU;)
    FROM ProductPart
    WHERE ProductPart.Qty * sum(CustOrder.Qty)
    ORA-00936: missing expression
    SELECT o.OrderDate AS "Date Ordered",
           o.OrderDate + 5 AS "Date Due",
           pp.PartID AS "Part No.",
        pp.NumOfParts * COUNT(o.SKU) AS "Qty"
    FROM CustOrder o
    JOIN ProductPart pp
      ON o.SKU = pp.SKU
        GROUP BY pp.PartID, o.OrderDate, COUNT(o.SKU)
    ORDER BY o.OrderDate
    ORA-00934: group function is not allowed here
    SELECT ProductPart.Qty,
           ProductPart.PartID,
           ProductPart.PartDesc
    (SELECT COUNT(CustOrder.SKU)
    FROM CustOrder
    GROUP BY CustomerOrder.SKU)TotalProducts,
    ProductPart.Qty * TotalProducts AS "Qty"
    FROM ProductParty
    WHERE CustOrder.SKU = Product.SKU
    AND Product.SKU = ProductPart.SKU
    ORA-00936: missing expression
    SELECT ProductPart.Qty,
           ProductPart.PartID,
           ProductPart.PartDesc
    (SELECT sum(CustOrder.qty)
    FROM CustOrder
    GROUP BY CustOrder.SKU)TotalProducts
        ProductPart.Qty * TotalProducts
        FROM ProductPart
    ORA-00936: missing expression

    Hi,
    893443 wrote:
    ... CREATE table CustOrder
    OrderID NUMBER(6) NOT NULL,
    Qty NUMBER(3) NOT NULL,
    OrderDate Date NOT NULL,
    SKU VARCHAR(10) NOT NULL CONSTRAINT fk_CustOrder_Product REFERENCES Product (SKU),
    CustID Number(6) NOT NULL CONSTRAINT fk_CustOrder_Customer REFERENCES Customer (CustID),
    PRIMARY KEY (OrderID)
    INSERT INTO CustOrder(OrderID, Qty, OrderDate, SKU, CustID)
    VALUES(2101, 2, '10-26-2011', 'DVCK1212', 1101);You're still trying to put a VARCHAR2 into a DATE column. Depending on your NLS settings, that may work on your system (at least today), but it definiely doesn't work on mine.
    Don't use a VARCHAR2 where a DATE is expected. Use TO_DATE to convert a string into a DATE:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e26088/functions203.htm#sthref1662
    Ideally The report would look something like this:Why not like this?
    ORDERDATE      PARTID PARTDESC                        TOTAL_QTY
    10-24-2011       1003 12" X 24" Ventilated Shelf             42
    10-24-2011       2001 12" X 12" Solid Shelf                 108
    10-24-2011       3001 12" X 96" Side Panel                   50
    10-25-2011       1004 12" X 30" Ventilated Shelf             72
    10-25-2011       2001 12" X 12" Solid Shelf                  54
    10-25-2011       2002 12" X 18" Solid Shelf                   6
    10-25-2011       3001 12" X 96" Side Panel                   44
    10-26-2011       1001 12" X 12" Ventilated Shelf             42
    10-26-2011       1004 12" X 30" Ventilated Shelf              6
    10-26-2011       2003 12" X 24" Solid Shelf                  12
    10-26-2011       3001 12" X 96" Side Panel                   20Did you make some mistakes in your results? If not, explain how to get the correct results in the places where the ouput above is wrong. For example, how do you get the row for orderdate of Oct 26 and partid=2001?
    {OrderDate    PartID    PartDesc NumOfParts(Total for that day)
    10-24-2011    2001    12" X 12" Solid Shelf 108
    10-24-2011    2003    12" X 24" Solid Shelf 32
    10-24-2011    3001    96" Side Panel 50
    10-25-2011    2002    12" X 18" Solid Shelf 6
    10-25-2011    2001    12" X 12" Solid Shelf 54
    10-25-2011    1004    12" X 30" Ventilated Shelf 72
    10-25-2011    3001    96" Side Panel 44
    10-26-2011    2001    12" X 12" Solid Shelf 12
    10-26-2011    2004    12" X 30" Solid Shelf 6
    10-26-2011    2003    12" X 24" Solid Shelf 12
    10-26-2011    1001    12" X 12" Ventilated Shelf 30
    10-26-2011    3011    96" Side Panel 20}Use \ tags, as described in my last message, before and after formatted text, to preserve spacing.
    My issue is, I can't get the equation right to produce the total number of parts. I think I need to multiply ProductPart.NumOfParts by SUM(CustOrder.Qty) Group by CustOrder.SKU.More likely that you need to multiply numofparts * qty, and then take the SUM of the result.
    Why would you GROUP BY sku?  Does each row of output represent a different product (and therefore a different sku), or does each row of output represent a different part. regardless of which product(s) that part is related to?
    If you want a separate total for each orderdate, you'll have to include orderdate in the GROUP BY clause, too.
    To get partdesc in the output, you'll either need to include partdesc in the GROUP BY clause, or wrap it in an aggregate fucntion.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to calculate the number of days until your next birthday. Only using current month, day and birth month and day.

    I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
    Attachments:
    D5.7_1.vi ‏8 KB

    I just had a little fun with the Time Record...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    D5.7_1_BD.png ‏19 KB

  • How to calculate the number of days worked for a given period

    I need to calculate the number of days worked by contractor employees for a time period to be entered by a user. I am building a query on an infoset which contains employee information including contract start date and contract end date for the employee.
    Ideally I'd like the user to enter the time period which should be reported on e.g. 01.08.2009 to 31.08.2009
    The report should then identify all the contractor employees which were working during this period and to work out how many days they worked during this period. Obviously the contract start and end dates could fall both inside and outside the reporting period.
    Can this be done and if so, do you have any suggestions as to how to do it?
    Thanks.

    hi
    So here you will first have to load the master data table employee in one internal table and read this table with the variables entries.
    Your code in the reporting exit should look like that.
    bye
    data : wa_employee type /bi0/pemployee.
    When 'ZDATE1'
    if i_step = 2.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE2'.
    clear l_s_range.
    clear wa_employee
    1- select the entries from table employees
    select single employee dateto datefrom
    from /bi0/pemployee
    into corresponding fields of wa_employee
    where dateto le loc_var_range-low
    and datefrom ge loc_var_range-high.
    if sy-subrc eq 0.
    CALL FUNCTION 'FIMA_DAYS_BETWEEN_TWO_DATES'
       EXPORTING
           i_datum_von  = wa_employee-datefrom
           i_kz_ult_von = 'X'
           i_datum_bis  = wa_employee-dateto
           i_kz_ult_bis = 'X'
           i_szbmeth    = '1'
       IMPORTING
          e_tage       = no_days.
           l_s_range-low  = no_days.
           l_s_range-sign = 'I'.
           l_s_range-opt  = 'EQ'.
          APPEND l_s_range TO e_t_range.
              ENDIF.
            ENDIF.
    endloop.
    ENDIF.
    Boujema

  • FM to get the number of days in Year,month and days by giving number of day

    Hi ALL,
    This is quit differnt.
    I need to give input the 'start date' and the 'number of days' and get the total days from the start date in year,month and day format.
    for example.
    start date :01.01.2009
    number of days as 32
    then i should get
    years:0
    months :1
    days :1
    Pleas help me out.

    hi Anusha,
    first u pass the date and the days to the following fm you will get the result date....
    data:date type sy-datum,
          r_date(10) type c.
    date = sy-datum.
    CALL FUNCTION 'CALCULATE_DATE'
    EXPORTING
       DAYS              = '32'
       MONTHS            = '0'
       START_DATE        = date
    IMPORTING
       RESULT_DATE       = r_date
    write:/ r_date.
    then you need to pass the result date and the date to the following fm to get the required output...
    CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
        EXPORTING
          date1                   = r_date
          date2                   = date
        IMPORTING
          years                   = v_years
         months                 = v_months
        days                     = v_days
        EXCEPTIONS
          invalid_dates_specified = 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.
    here u will get the difference in days,  months and year...
    i hope u wil get help from this...
    regards
    Ashu  Singh

  • How to get the number of days of a month belonging to a date interval

    Hi, i am getting mad around a problem, i have 2 dates and a month, i wanto to retrieve the number of days belonging to the month that are in the interval.
    eg:
    month january 2011 . begin_date = 11/JAN/2011, END_DATE 30/MAY/2011 result is 21
    month january 2011 . begin_date = 11/DEC/2010, END_DATE 10/JAN/2011 result 10
    month january 2011 .begin_date = 02/FEB/2011 , END_DATE 25/may/2011 result 0
    month january 2011. begin_date = 03/JAN/2011 , END DATE 05/JAN/2011 result 3
    and so on ...
    i appreciate any suggestion
    thank you
    Andrea

    Oh, I didnt see your result.
    SQL> with t as
      2  (select  to_date('11/01/11','dd/mm/yy') from_dt,
      3           to_date('30/05/11','dd/mm/yy') to_dt,
      4           'Jan-11' mnth from dual
      5           union all
      6           select  to_date('11/12/10','dd/mm/yy') from_dt,
      7           to_date('10/01/11','dd/mm/yy') to_dt,
      8           'Jan-11' mnth from dual
      9           union all
    10           select  to_date('02/02/11','dd/mm/yy') from_dt,
    11           to_date('25/05/11','dd/mm/yy') to_dt,
    12           'Jan-11' mnth from dual
    13           union all
    14           select  to_date('03/01/11','dd/mm/yy') from_dt,
    15           to_date('05/01/11','dd/mm/yy') to_dt,
    16           'Jan-11' mnth from dual
    17           )
    18  select from_dt,to_dt,mnth,
    19         greatest(
    20              least(last_day(to_date(mnth,'Mon-yy')),to_dt)
    21              -
    22              greatest(to_date(mnth,'Mon-yy'),from_dt)+1
    23                 ,0) cnt
    24  from t;
    FROM_DT   TO_DT     MNTH          CNT
    11-JAN-11 30-MAY-11 Jan-11         21
    11-DEC-10 10-JAN-11 Jan-11         10
    02-FEB-11 25-MAY-11 Jan-11          0
    03-JAN-11 05-JAN-11 Jan-11          3

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

    hi all
    is there any way to get the number of days in a given month with a given year? for instance, if year is 2004 and the month is July or February, how can i get the number of days? thanks.

    Gee, I don't know ... Maybe this:
    Calendar cal = Calendar.newInstance();
    cal.set(Calendar.YEAR, 2004);
    cal.set(Calendar.MONTH, Calendar.FEBUARY);
    System.out.println("max days in month: " + cal.getActualMaximum(Calendar.DAY_OF_MONTH));
    Do you not bother reading what people have already posted? Read the API docs on the Calendar class.

  • How to get the number of days of February.....

    Hi ,
    how can I get the number of days (28 or 29) of February of the current year or the next...????
    Or is there any other way to find that a year is a leap or not (i mean the year has 365 or 366 days).??
    Thanks
    Simon

    select add_months(to_date('&v_year', 'YYYY'), 12) -
    to_date('&v_year', 'YYYY') from dual;Jens, it seems we have made the same mistake, trunc usage seems mandatory :
    SQL> ed
    Wrote file afiedt.buf
      1* select add_months(to_date('2007', 'YYYY'), 12) - to_date('2007', 'YYYY') from dual
    SQL> /
    ADD_MONTHS(TO_DATE('2007','YYYY'),12)-TO_DATE('2007','YYYY')
                                                             366
    SQL> ed
    Wrote file afiedt.buf
      1* select add_months(trunc(to_date('2007', 'YYYY'), 'YYYY'), 12) - trunc(to_date('2007', 'YYYY'), 'YYYY') from dual
    SQL> /
    ADD_MONTHS(TRUNC(TO_DATE('2007','YYYY'),'YYYY'),12)-TRUNC(TO_DATE('2007','YYYY')
                                                                                 365
    SQL> Just to clarify my past doubt.
    Nicolas.

  • How to determine the number of rows to be displayed in a report

    hello experts,
    Has anyone ever come across this requirement before? Before a report finishes being executed and before it displays the results, is there a way to determine the number of rows to be displayed as the result?
    Many thanks in advance.
    Regards,
    Inma

    Hello Arun,
    Thanks for your reply but do you know which method I should use for this purpose if I use the table interface?
    Thanks,
    Inma

  • How to determine the number of messages in a queue, that ...

    Hi,
    what's the proper way to count the number of the messages in an Advanced Queue that are currently visible to consumers?
    Currently we use:
    select count(*) from aq$queue_tab_name q where q.QUEUE = 'Q_NAME';
    The problem with that approach:
    If one consumer dequeues a lot of messages in one transaction, that change in the number of messages visible to other consumers is only made visible after the consumer issues a commit. Before the commit is issued, the above "select count(*) ..." statement (issued from a different DB-session) does not reflect the fact that one consumer consumed a lot of messages, messages that are not available to other consumers anymore (only exception: the original consumer issues a rollback sooner or later).
    So before the commit is issued:
    -the consumed messages are NOT visible to other consumers anymore (which is intended behaviour)
    -but the "select count(*) ..." statement (issued from a different DB session) does NOT reflect that fact
    So the case could arise that the queue becomes empty, while "select count(*) ..." says that e.g. 1000 messages are still in the queue.
    Is there a solution to this problem?
    PS: For our use-case we need these dequeue option :
    dbms_aq.remove;
    dbms_aq.first_message;
    dbms_aq.on_commit;
    Again, the queue itself works correctly, I just need to find a way to determine the number messages that are currently dequeable / visible to the consumers at specific point in time.
    I couldn't find a func/proc in dbms_aq for that purpose.
    Best wishes
    Peter

    The following might be of interest in better understanding the issue you are facing in a broader context:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5771117722373

  • How do you show the number of days per month?

    How do you show the number of days per month?
    I am working on a budget.  I want to know how much to amortize each month to fund an investment.  Income comes monthly, but expenses leave in days, or weeks.  The number of days and weeks in months vary. 
    I want to figure out income and expenses per day, per month and per year, so I know how much can be invested each month, week or day.  For a start I would like a formula that shows how many days are in each month?

    thanks..
    I solve my problem as
    public class MyExample {
        public static void main(String a[]) {
            String stdate = "2009-03-01";
            java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
            java.sql.Date preDate = java.sql.Date.valueOf(stdate);
            System.out.println(currentDate);
            System.out.println(preDate);
    //        int dateCom = preDate.compareTo(currentDate);
    //        System.out.println(dateCom);
            long diff = currentDate.getTime() - preDate.getTime();
            int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
             System.out.println(days);
    }

  • Function Module to determine the number of pages in a pdf file

    Hi All,
    Is there any standard function module to determine the number of pages in a pdf file?
    Thanks,
    Sai

    Hi unk2,
    There's no functionality in the Acrobat.com online services to do a character count. But, you could use ExportPDF to convert your PDF file to Word format, and then do your character count in Word.
    Please let us know if you need additional assistance.
    Best,
    Sara

  • How do you work out the number of days difference between two dates?

    I'm running Crystal v12.
    We use a date field in our SQL database that we use to store the client's year end date.
    As the year end date (date and month) doesn't change for a client, the year end date field in all of our reports is set to just show the DD/MM part. Over the years as new clients are set up we just enter the date and month - the year part is irrelevant although as in all date fields the year is automatically entered.
    Doing it this way means that we don't have to adjust the year end year part each year. We just use the DD/MM part.
    I need to create a formula that works out the number of days there have been (i.e. the difference) from the current date to the year end date. It MUST EXCLUDE the year however.
    For example:
    Year End Date = 30/04/03
    Current Date = 25/05/10
    Days Difference (EXCLUDING year) = 25
    Days Difference (including year) = 2582
    Year End Date = 31/03/09
    Current Date = 25/05/09
    Days Difference (EXCLUDING year) = 55
    Days Difference (including year) = 420
    If you include the year part then working out day difference is simply a case of creating a formula that subtracts the year end date from the current date (CurrentDate - {tblClient.YearEnd}.
    HOWEVER I need to exclude the year part.
    Can anyone tell me the formula or best way to do this?
    Thanks in advance.
    Edited by: BadBoy House on May 25, 2010 3:15 PM
    Edited by: BadBoy House on May 25, 2010 3:15 PM

    Hi
    You can try this
    datevar e := date(year(currentdate),month({tblClient.YearEnd}),day({tblClient.YearEnd}));
    numbervar num_days := datediff("d",currentdate,e)
    Create a datevar called e that uses the original month and day numbers for {tblClient.YearEnd} but uses the year of the current date
    Then just datediff on e to get the number of days between the two dates
    I hope i understand your problem and that this helps
    Best regards
    Patrick

Maybe you are looking for