Calculation on dates

Hi,
I need to subtract two dates.How can I do that.

Bad idea. What about leap years? Getting down to milliseconds is hardly
taking advantage of abstraction.
Let Calendar or a suitable wrapper do it.If you define D1-D2 as the time difference between the two dates D1 and D2,
solving the thing using milliseconds isn't that bad. A Date or Calendar class
takes care of the leap years/seconds etc. and all you want is a difference in
time (which is an absolute value) and it doesn't matter much how that time
value is represented, i.e. millis, seconds or whatever ...
I do agree that one of those terrible Calendar objects can handle the job better
than that silly Date class ;-)
kind regards,
Jos

Similar Messages

  • Plannned Delivery time not considered while calculating delivery date

    Hi PP Gurus,
    We have a situation is that after MRP run system is not taking into account planned delivery time while calculating delivery dates in schedule lines
    It is taking into account GR processing time.We have GR processing time of 3 days.requirment date is 13.10.2011 & delivery date created by the system is 10.10.2011.
    We have maintained correct master data i.e.Materail Master , Info record & Scheduling agreement.
    Please advice why it is happening & what is the significance of planned delivery time in externaly procured materail with scheduling agrement schedule lines?
    Thanks & Regards,
    Sandesh

    Hi Sandesh,
    Is this happening for particular materials or for all materials
    Couple of checks -
    1) Check with material master changes, might be after MRP run PDT is updated in material master etc ..
    2) Check in OPPQ, for option external procurement , whether scheduling info records/agree is marked or not
    Best Regards
    K.Madhu Kumar

  • Example: Calculating Operation Dates

    Hi Gurus,
    http://help.sap.com/saphelp_46c/helpdata/en/7e/d4191b455911d189400000e8323c4f/frameset.htm
    Menu path: Routings > Scheduling Routings > Example: Calculating Operation Dates
    We have an example in SAP library in the above link.
    As per that queue time, setup time and processing time it is taking 10min extra.
    I mean the setup time is 0.5hrs, but as mentioned in the example,the setup start at 09.20 and setup end at 10.00. My doubt is setup end time should be 09.50. Why it is taking 10min extra.
    Please refer to this example in Library and explain why this difference.
    Regards,
    Jejesh

    Dear,
    please refere the example as the Working Time for work Center is 8 hours Which is then reduced to 6 hours after subtracting breaks & Utilization factor it comes as 6 hrs.
    So the Total reduction is 25% this means that all timings will be set by adding 25 % so that they can be set in 8 Hr scale. the 10 min that u are refering is result of that.
    Think & Try to set the Time considering Breaks & Utilization factor for a Problem ur self u will then able to appriciate that example.
    Regards
    samunder singh

  • Bapi_acc_document post is not calculating baseline date based pymnt terms

    Hello friends,
    Im using bapi_acc_document_post to post db and cr note and i m passing payment terms in the input file but the bapi is not calculating baseline date .
    pleasee let me knw the solution.
    Regards,
    Sunny

    that's the disadvantage of bapis and direct input in opposite to BDC. So use "old" rfbibl00 with batch input!
    A.

  • Calculation of dates in Sales order in gATP

    Hi
    Can anybody please tell me how scheduling works for the following dates in sales orders for materials planned in gATP.
    1) Unloading date 2) Delivery date 3) Goods issue date 4) Loading date 5) Material availability date 6) Transportation planning
    My understanding is that gATP gives the MAD date and other remaining dates like transportation planning date, unload date etc are calculated using master data in the calling system eg ECC.
    We are facing an issue in our system where if a material is planned in ECC, it has all dates in the sales order calculated as expected based on ECC master data.
    If the same material is planned in gATP, it simply copies the MAD date to all other dates. So it is not considering the pick/pack , transportationplanning times from the ECC master data.
    Is this standard system behaviour and to avoid this  Do we need to activate Scheduling in gATP along with master data maintenence in APO ?or any user exit plus execution steps is avaialble to by pass APO master data mentaince.
    Appreciate your responses...Regards - Amit

    Amit,
    We are facing an issue in our system where if a material is planned in ECC, it has all dates in the sales order calculated as expected based on ECC master data.
    If the same material is planned in gATP, it simply copies the MAD date to all other dates.
    The system where the parts are planned is irrelevant.  The important issue is the system where the ATP is conducted.
    My understanding is that gATP gives the MAD date and other remaining dates like transportation planning date, unload date etc are calculated using master data in the calling system e.g. ECC.
    I have never seen that statement validated in any SAP documentation.
    From online help:
    SAP R/3 uses the order type to determine whether shipment scheduling or transportation scheduling should be executed.
    If scheduling is activated, SAP R/3 determines a plant for the material for each item. If it is specified in the integration model that the availability check should take place in SAP APO for a material in this plant, transportation and shipment scheduling also takes place in SAP APO.
    Standard SAP APO GATP supplies three different methods for shipment scheduling.  If you are conducting ATP in APO, and you have not configured one of the three scheduling methods, then shipment scheduling does not take place, and the system will react as you have described.  
    Read up on it here
    http://help.sap.com/saphelp_scm70/helpdata/EN/05/f8923945b12c4de10000000a114084/frameset.htm
    Best Regards,
    DB49

  • How to get a calculated default date value as filter prompt

    Dear Colleagues,
    I would need to get a calculated date as dafault value in a query filter promp.
    I tried to use the token <%TODAY%> to set by default the current date and it works.
    But I'd need to set 6 months before the current date as default value in the filter prompt. Any idea to get it?
    I tried to set <%TODAY%> - 120 for example  but it's not working because I think the system is taking this as a DATE type value.
    Thanks in advance!
    Regards.
    Martin

    Dear Colleagues,
    I would need to get a calculated date as dafault value in a query filter promp.
    I tried to use the token <%TODAY%> to set by default the current date and it works.
    But I'd need to set 6 months before the current date as default value in the filter prompt. Any idea to get it?
    I tried to set <%TODAY%> - 120 for example  but it's not working because I think the system is taking this as a DATE type value.
    Thanks in advance!
    Regards.
    Martin

  • Error in activating Sqlscript Calculation view - Data type mismatch

    Hi All,
    I am trying to create a Calculation view using sql script. When I try to activate the calculation view I get the below error., Could you please help.
    Error
    Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: transaction rolled back by an internal error: column store error: [34011] failed to save calculation scenario : The following errors occured: Inconsistent calculation model (34011)nDetails (Errors):n- CalculationNode (_ELECTION_ANALYTICAL_VIEW) -> attributes -> attribute (VOTE):
    Datatype int of VOTE does not match to datatype fixed18.0(9) in datasource.
    nnnSet Schema DDL statement: set schema "_SYS_BIC"nType DDL: create type "_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_SQL_CA/proc/tabletype/VAR_OUT" as table ("VOTE" INTEGER, "NAME_1" VARCHAR(250), "NAME_4" VARCHAR(250))nProcedure DDL: create procedure "_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_SQL_CA/proc" ( OUT var_out "_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_SQL_CA/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data as  n /********* Begin Procedure Script ************/ n BEGIN n n election_analytical_view = CE_OLAP_VIEW("_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_RESULTS_ANA",[VOTE,NAME,NAME_1,NAME_3,NAME_4]);n n var_out = CE_PROJECTION(:election_analytical_view,[VOTE,NAME_1,NAME_4]);nnnnEND /********* End Procedure Script ************/n
    SQL Script
    /********* Begin Procedure Script ************/
    BEGIN
    election_analytical_view = CE_OLAP_VIEW("_SYS_BIC"."p1940328499trial.logesh.HanaElection/ELECTION_RESULTS_ANA",[VOTE,NAME,NAME_1,NAME_3,NAME_4]);
    var_out = CE_PROJECTION(:election_analytical_view,[VOTE,NAME_1,NAME_4]);
    END /********* End Procedure Script ************/

    Hi Logesh,
    You have to use at least one aggregation while using CE_OLAP_VIEW. You can not use the same with out aggregation of at least on of the available measures .
    page 96 of SQL Script reference says
    Note you must have at least one <aggregation_exp> in the attributes.
    where
    <aggregate_exp> ::= <aggregate_func>(<aggregate_column> [AS <column_alias>])
    Specifies the required aggregation expression for the key figure.
    <aggregate_func> ::= COUNT | SUM | MIN | MAX
    Specifies the aggregation function to use. Supported aggregation functions are:
    ●count("column")
    ●sum("column")
    ●min("column")
    ●max("column")
    Sreehari

  • Calculation with Dates

    I have one date called Registration Date which will be input into the planning as string in dd--mm-yyyy format. Now I am capturing current date which should pickup from system(By @Today Function).
    I know that these dates are now in different formats. I need to calculate difference between these two dates.. I have tried many ways using datediff functions etc. But its not working. please Help me out on this

    Hi
    Try using @HspDateDiff
    You will need to convert the current date into the planning version of the date. You can do this with this formula
    (@DATEPART(@TODAY(),DP_YEAR)*10000) + (@DATEPART(@TODAY(),DP_MONTH)*100) + (@DATEPART(@TODAY(),DP_DAY));
    This will take the current date and put it into the YYYYMMDD format.
    You can then use @HspDateDiff(NewCurrentDate,RegistrationDate);
    You can use this link to help you with the use of @HspDateDiff Calculating the difference between dates within Hyperion Planning - Absolute EPM
    In later versions of Hyperion Planning there are many more functions for Dates within Calculation Manager
    Hope that helps.
    Anthony
    Home - Absolute EPM

  • How do you get a fillable pdf to perform a new calculation if data is changed on form

    I have created a form to calculate payment terms. The forms work great however if you make a mistake inputting or change data after calculation has been preformed i need the new data to be calculated. Is there a way to do this?
    thanks

    Hi Gilad,
    Thank you for the information. Unfortunately the form that I built does not provide the correct number if any data is changed.
    Is there something that I am missing?
    I am using the form to complete and installment loan contract
    Thanks again

  • Calculation delivery date for items

    Hello,
    I am looking for the option to set a delivery date calculation in master data so this will be automatically calculated in sales and purchase documents.
    The only thing that comes remotely close is the 'Lead Time' in tab 'Planning Data' but this will only be used in MRP runs.
    I want to set per Business Partner and/or Item a delivery date calculation. For instance it will take 5 (working) days before the item will be delivered. Therefore when entering a PO it will update the delivery date automatically from today plus 5 days.
    Same will go for the SO calculating the delivery date if there is no stock from the set delivery date calculation.
    It seems I have to set this up myself via UDF's with queries?!
    Kind regards,
    Petronella

    If the lead time is always the same length for the item irrespective of the BP then you could store this in an UDF on the item master. 
    If the lead time is per BP then it can be an UDF on the BP Master data.  However if its a matrix of per BP and Item then you can do this by creating a user defined table. 
    I have done something similar to this, a few quick pointers would be:
    Create User Defined Table (eg. @Leadtime)
    Add 3 user defined fields to the table, CardCode, ItemCode and Leadtime
    Open up the table and add a formatted search to the BP Code UDF (e.g. Select t0.CardCode, t0.CardName from OCRD t0 where t0.CardType = 'C')
    add a formatted search to the Item Number UDF (select t0.ItemCode from OITM t0)
    Add a UDF on the marketing document lines called Leadtime.
    Add a formatted search to the leadtime field (select T0.[U_Leadtime] FROM [dbo].[@Leadtime] T0 Where T0.[U_BPCode] = $[$4.CardCode] AND T0.[U_ItemCode] = $[$38.1.0])
    That should pull through the leadtime based on the BP and Item on the marketing document, you will then need to add a formatted search to the delivery date field on the rows by picking up the document date and adding the leadtime UDF days to it.  I'm afraid I don't have SBO open and I can't remember the variable for picking up the document date, you can find this out by clicking View | System Information.  To pick up the leadtime udf it will be $[$38.U_leadtime.0] i think.
    Regards,

  • Calculations during Data Modeling

    Hey guys,
    Is there a way to do calculations using key figures during data modeling or it has to be done at the query level?
    Thank You

    Dezi,
    You can make them in the Transfer Rules or Update Rules.
    The advantage of doing them in the queries is that if the specs for the formula change, you just need to modify the logic in the query. Whereas if you have the values "harcoded" in the cube or ods, you'll need to reload the data or come up with something else to fix them.
    Of course, having too many calculations in the queries can create performance issues.
    It's all a balance...
    Regards,
    Luis

  • Formula variable for date calculations with date-characteristics (2004s)

    Hi SDN,
    I'd like to calculate the number of days between to date-characteristics. In 3.5, I was used to create 2 formula variables of the type 'replacement path', with 'date' as the dimension indicator. In my formula, I used the 'proces value as date' function for each variable, and I could perform calculations with them.
    I'm trying to do the same in 2004s. However, I can't create replacement path's with 'date' as a dimension indicator. So I use 'number' instead, but it doesn't work: my query shows 'x'.
    I can use the variables that I created using the 3.5 query designer as a workaround. But I hope there is a better solution.
    If other people experience the same problem, please respond. Then I know it's probably a bug.
    Kind regards,
    Daniel

    Daniel,
    Try to look at the formula variables defined before the upgrade and see what is different to the newly defined. I am guessing just the terminology used is different.
    If not the date value might be blank or something for one of the f-variables used. Try to display the formula variable values as KF in the query results and check what it is showing.
    I hope this helps.
    -Bala

  • Week and month calculation from date column

    I have 3 column data like
    with tab as
      select 'Topshop' brand, '10-JUL-11' deliverydate, '100' qty from dual union all
      select 'Topshop' brand, '10-JUL-11' deliverydate, '400' qty from dual union all
      select 'NewSita' brand, '11-JUL-11' deliverydate, '200' qty from dual union all
      select 'LaGress' brand, '12-JUL-11' deliverydate, '300' qty from dual union all
      select 'LaGress' brand, '10-AUG-11' deliverydate, '100' qty from dual union all
      select 'LaGress' brand, '11-AUG-11' deliverydate, '200' qty from dual union all
      select 'Topshop' brand, '12-AUG-11' deliverydate, '300' qty from dual union all
      select 'NewSita' brand, '10-SEP-11' deliverydate, '100' qty from dual union all
      select 'Topshop' brand, '11-SEP-11' deliverydate, '200' qty from dual union all
      select 'NewSita' brand, '12-SEP-11' deliverydate, '300' qty from dual
    ) select * from tabI need to convert it into 4 columns
    Brand | Month | Week(start date) | Qty (sum)
    Please let me know what are the options that i have, especially the date-time calculation functions available to solve such problems.
    Thanks
    w\

    with tab as
      select 'Topshop' brand, to_date('10-JUL-11', 'dd-mon-yy') deliverydate, '100' qty from dual union all
      select 'Topshop' brand, to_date('10-JUL-11', 'dd-mon-yy') deliverydate, '400' qty from dual union all
      select 'NewSita' brand, to_date('11-JUL-11', 'dd-mon-yy') deliverydate, '200' qty from dual union all
      select 'LaGress' brand, to_date('12-JUL-11', 'dd-mon-yy') deliverydate, '300' qty from dual union all
      select 'LaGress' brand, to_date('10-AUG-11', 'dd-mon-yy') deliverydate, '100' qty from dual union all
      select 'LaGress' brand, to_date('11-AUG-11', 'dd-mon-yy') deliverydate, '200' qty from dual union all
      select 'Topshop' brand, to_date('12-AUG-11', 'dd-mon-yy') deliverydate, '300' qty from dual union all
      select 'NewSita' brand, to_date('10-SEP-11', 'dd-mon-yy') deliverydate, '100' qty from dual union all
      select 'Topshop' brand, to_date('11-SEP-11', 'dd-mon-yy') deliverydate, '200' qty from dual union all
      select 'NewSita' brand, to_date('12-SEP-11', 'dd-mon-yy') deliverydate, '300' qty from dual
    ), week_data as (
       select brand
       ,      to_char(deliverydate, 'Month', 'nls_date_language=american') MON
       ,      trunc(deliverydate, 'day') WEEK_START
       ,      sum(TO_NUMBER(qty)) SUM_QTY
       from   tab
       group by brand
       ,      to_char(deliverydate, 'Month', 'nls_date_language=american')
       ,      trunc(deliverydate, 'day')
    ), weeks as (
       select
       w.week_min + (level - 1) * 7 week_start
       from (
          select min(week_start) week_min, max(week_start) week_max
          from week_data
       ) w, dual
       connect by level <= 1 + (w.week_max - w.week_min) / 7
    select
    week_data.brand,
    weeks.week_start,
    nvl(week_data.sum_qty,0) sum_qty
    from week_data
    partition by (brand)
    right outer join weeks
    on (weeks.week_start = week_data.week_start)
    order by
    weeks.week_start,
    week_data.brand;You construct a set of records of all "week_start" dates from your minimum to your maximum (classic connect by level trick.)
    You use a partitioned outer join to fill in the gaps in your sparse data (see doc example [url http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_10002.htm#i2177515]here.
    Hope that helps you :-)
    (PS. I dislike implicit conversions - that is the only reason I have added a TO_NUMBER to your code within the sum() ;-) )
    (PPS. Actually you probably should have asked this in a new question - I believe it is not really good forum etiquette to continue in a thread that has already been answered...)

  • I want to do calculation between date/time fields

    Post Author: fmonsma
    CA Forum: Publishing
    Hi, I already post this question a couple of times but I can't make it work.
    IST:I  have converted a date/time field to a field so i can make calculation on it but i don't know ho to convert it to minuts;seconds.
    Starttime        - Endtime           - Convert begin - Convertend - convertsumbegin - convertsumend - difference between31-7 12:39:00 - 31-07 13:08:00   - 123900    -    010800 - 123.900 - 10.800 -  -113.100
    SOLL
    Start time - Endtime - Differencebetween12:39 - 13:08 - 0:29
    If i make this calculation in Excel it's very simple and works perfect. I want this in my Webintelligence report but don't know which functions/script i need to have. Thanks;

    Post Author: jsanzone
    CA Forum: Publishing
    fmonsma:
    Based on the sample data that you provide, it appears that you want to be able to report data based on the number of minutes that have elapsed between "Starttime" and "Endtime".  Looking at the WebI Variable Editor functions in the "Date & Time" functions list, it does not appear that there are any capability to determine elapsed minutes (it appears that the only "time" of the "Date & Time" functions is the "CurrentTime" function, not much else in regards to time...)
    You don't mention the database platform you are using, however, if you happen to be using MS SQL Server, then they have the DATEDIFF function.  Within DATEDIFF the parameters are: DATEDIFF ( datepart , startdate , enddate ), where datepart specificies any of the following facts:  Year, quarter, Month, dayofyear, Day, Week, Hour, minute, second, millisecond
    Bottom line, you will most likely not be able to rely on WebI to determine the elapsed seconds and you'll have to set up an object within your Universe to do the work on the database server and bring it across to your reports that way.

  • Sales Order : Calcul delivery date with only working days

    HI,
    When I create sale order, the delivery date is calculed with the number of days mentionned in type of sale document. SAP add this number of days into the day's date.
    Is it possible to calculate this delivery date only with working days in the corporate calendar ???
    Thank's

    HI
    Delivery date in the Sales order will be calculated the calender only basedon the Transportation lead time and Pick/Pack time and excluding the holidays
    Please cross the same in your instance
    Regards,
    Ram.

  • Calculations for data collection

    Hi,
    In 'formula' type parameter for data collection, for the first time when operator enters values, the formula parameter does the calculation and give results.
    However, if later on the same data is edited, then the calculations donot take place and operator himself has to calculate and update the field.
    foreg: P1 and P2 are 2 parameters under 1 DC group.
    P3=P1+P2.
    When operator enters for the first time values for P1 and P2, P3 gets calculated. However, If later on values for P1 and P2 are edited through 'data collection edit' activity, P3 calculations donot change and operator has to calculate it and re-enter in P3 field.
    This is my understanding, please correct me if these calculations automatically takeplace whenever the base values are edited .
    Thanks.
    Regards
    Mansi

    nimaq,
    One of my more astute coworkers (a know it all, so he thinks, hehe), reminded me that we do sell a PCMCIA/Cardbus PXI Chassis controller and a ExpressCard PXI controller (if you have a computer with an ExpressCard slot).
    Cardbus controller link...
    NI PXI-CardBus8310
    ExpressCard controller link...
    NI PXI-ExpressCard8360
    If you buy a PXI controller for your Laptop, a PXI Chassis, and a PXI digital frame grabber, then you will have a system that allows you to grab images from your digital camera via your Laptop.  If you have not yet purchased a Laptop, I highly recommend you purchase a Laptop with an ExpressCard slot (they have much higher bandwidth) which you will want for frame grabbing.
    Below is a Link to a 4 slot PXI Chassis...
    NI PXI-1031
    Below is a Link to a Digital PXI Frame grabber...
    NI PXI-1422
    Buying these 3 products (PXI-ExpressCard8360, PXI-1031, and the PXI-1422) and the proper laptop, will give you a top of the line digital camera acquisition system.
    Lorne Hengst
    Application Engineer
    National Instruments

Maybe you are looking for

  • Memory upgrade on Satellite P205

    Gents, is it possible to increase RAM memory to 6 or 8 GB Windows 7 in the Satellite P205-S6337? Can it use Windows 7 , operating in 64 bits ? Thank you

  • Where did the AS Language Guide go?

    I've always used Apple's Language Guide pages for quick lookups of AppleScript syntax, but they've been 404 since the 13th. I'd download the PDF as directed by the Scripting and Additions List. But that's 404, too! So, where to go for an online index

  • Error - Could not place the document 'IMG_1664.MOV' because no parser...

    I am trying to open a video to edit within Photoshop CS6 x64. I am getting the following message:- Could not place the document 'IMG_1664.MOV' because no parser or file format can open the file. The video was shot on my iphone 4S and ive even tried c

  • ADF - Component File Download Listener - Setting the output filename

    Studio Edition Version 11.1.1.2.0 Hi, I would like to learn how to set the output filename as current data + filename. I have a button with the component File Download Listener that has theses parameters Content/Type: application/pdf Filename: test.p

  • Difference between Abstract Classes Vs Interface

    Hi, Can u pls mention all the differences between Abstract Classes and Interface.? I've mentioned the differences I've known here. Known Differences: (*) An interface cannot implement any methods, whereas an abstract class can. (*) A class can implem