Conversion of microseconds to number of days in OSB

Hi All,
I want to convert a string variable (e.g1245677889) which represents microseconds.I want to convert this microseconds to corresponding number of days in OSb.I there any xquery function that can be directly used to get the number of days????
thanks in advance!!!!

Thanks for the reply.
I have already done that,But my requirement is to get the corresponding date (with 1970-01-01 as the reference date).
So i want something in date format on which i can apply some boilt in functions.
Is there any way we can do increament of an date variable in OSB???
that will also help if i can increase the date the number of times i get converting miliseconds to days(eg. if miliseconds=86400000 i have to increase the reference date once as 86400000 corresponds to 1 day only) .

Similar Messages

  • Conversion of Date into Number of Days

    Hai All,
               Can anyone pls tell how to convert the Date format into Number of days.
    For example I have 2 dates, 25.03.2009 and 25.02.2009.
    I have to take the difference of these two dates, means its 30 days.
    Later I have to move this 30 days to a variable and display.
    Can anyone help me.

    Try these FMs.
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
    EXPORTING
    i_datum_bis = p_sdate
    i_datum_von = p_edate
    IMPORTING
    e_tage = l_differ
    EXCEPTIONS
    days_method_not_defined = 1
    others = 2.
    WRITE:/ l_differ.
    call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
    exporting
    i_date_from = p_sdate
    i_date_to = p_edate
    I_FLG_SEPARATE = ' '
    IMPORTING
    E_DAYS = EDAYS
    E_MONTHS = EMONTHS
    E_YEARS = EYEARS.
    WRITE:/ No of Days ', EDAYS.
    Regards,
    Joan

  • Customer Exit for Number of Days from 1 st Apr to last date of Month Enter

    Hello BI Experts,
    I have a requirement to count the number of days from 1 st April of current year to the last date of month entered.
    For example : The use will enter say July 2010 or 003.2010  (as Fiscal Year Variant is V3 ).
    Today is 14 July ...So we have to first find out the end date of the July month ie 31 st July
    Then go to 1 st April 2010.
    Now calculate the Number of days between 1 st April to 31 st July 2010.
    I consider I have to create two Customer Exit variable
    as below
    1 st customer exit Bex variable  say  ZLY_MTH  ( Last day of Month Entered)
      and i_step = 1
    2 nd Customer Exit BEx Formula variable say ZF_NUMDAYS ( Number of days between two dates)
    i_step =1 .
    Please provide me the logic for the above two.
    Thanks in Advance.
    Regards,
    Amol Kulkarni

    PSUDEO CODE:
    1. Initially LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZMONTH'.
    2. Get the Month input using VAR_MONTH2 = LOC_VAR_RANGE-LOW+4(2)
    3. Now calculate Month+1: VAR_MONTH2 = VAR_MONTH2 + 1 (Refer **)
    4. Now calculate the Current Year: VAR_YEAR = LOC_VAR_RANGE-LOW+0(4).
    5. Get the 1st Day of the Month (VAR_MONTH2):  CONCATENATE '01' '/' VAR_MONTH2 '/' VAR_YEAR INTO L_S_RANGE-LOW.
    6. SUBRACT 1 (0DATE) from this DATE (This will give the logic for last day of the current month)
    Insert this code also for using the date conversions
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                INPUT  = VAR_MONTH2
              IMPORTING
                OUTPUT = VAR_MONTH2.
    Pls. check out this logic. Guess it would solve your need.
    Thanks,
    Arun Bala

  • Number of days in a month

    I want to get this result in BEX. Please let me know how to get this. The result rows are shown below
    Month          Sales               No of days in
    ZCMNTH          $8000
    ZCMNTH-1     $7500
    ZCMNTH-2     $5000
    A sample of how the values should appear
    Month          Sales               No of days
    11/2005          $8000                    30
    10/2005          $7500                    31
    09/2005          $5000                    30
    08/2005          $9700                    31
    07/2005          $9850                    31
    So at query time how do I get the values for the number of days?
    Thanks for help
    Ram

    Gopalakrishna -
    I just ran across the same problem. Instead of using the RSR00002 enhancement I used the BADI implementation. I found it easier to understand and I think it will be easier to maintain. I couln't find a lot of good documentation (HOW TO... Use variable time references in currency conversions was helpful though) about how to do it so here is how I did it.
    1.In SE19 create an implementation based on rsr_olap_badi
    2.Tell it which infoprovider(s) to look for under Defined Filters. (You can use wildcards here if you want)
    3.Click on the Interface Tab and double click on the implementing class.
    4. Define attribute on the Attributes tab. Characteristics must start with P_CHA and key figures must start with P_KYF ex. P_CHA_0CALMONTH2, P_CHA_0CALMONTH, P_KYF_ZNUMDAYS all must have type I.
    5. In methods tab double click the define method. Here is where you tell it which characteristics and key figures to look for. Here is an example.
    DATA: l_s_chanm   TYPE rrke_s_chanm,
            l_kyfnm     TYPE rsd_kyfnm.
      FIELD-SYMBOLS:
            <l_s_chanm> TYPE rrke_s_chanm.
      CASE i_s_rkb1d-infocube.
        WHEN 'YOUR_CUBE_TECHNICAL_NAME_GOES_HERE'.
        characteristics
          l_s_chanm-chanm = '0CALMONTH2'.
          l_s_chanm-mode  = rrke_c_mode-read.
          APPEND l_s_chanm TO c_t_chanm.
          l_s_chanm-chanm = '0CALYEAR'.
          L_S_CHANM-MODE = RRKE_C_MODE-READ.
          APPEND L_S_CHANM TO C_T_CHANM.
        key figure
          l_kyfnm = 'ZNUMDAYS'.
          APPEND l_kyfnm TO c_t_kyfnm.
      ENDCASE.
    ENDMETHOD.                    "if_ex_rsr_olap_badi~define
    6. Double click on the compute method. Here is where you will populate the key figure. Here is an example. I had to wirte a function module because we only wanted work days versus all days of the month. But you get the idea.
    METHOD IF_EX_RSR_OLAP_BADI~COMPUTE .
    FIELD-SYMBOLS: <L_YEAR>    TYPE ANY,
                  <L_MONTH>    TYPE ANY,
                  <L_WORKDAYS> TYPE ANY.
    if P_CHA_0CALYEAR <> 0 AND P_CHA_0CALMONTH2 <> 0.
       assign: component P_CHA_0CALYEAR of structure C_S_DATA to <l_YEAR>,
             COMPONENT P_CHA_0CALMONTH2 OF STRUCTURE C_S_DATA TO <L_MONTH>,
             COMPONENT P_KYF_ZNUMDAYS OF STRUCTURE C_S_DATA TO <L_WORKDAYS>
    CALL FUNCTION 'Z_SELECT_FACTDAYS_FOR_PERIOD'
           EXPORTING
                     I_MONTH    = <L_MONTH>
                     I_YEAR     = <L_YEAR>
                     I_FISYRVAR = I_FISYRVAR
           IMPORTING
                     E_WORK_DAYS = <L_WORKDAYS>.
    endif.
    ENDMETHOD.                    "IF_EX_RSR_OLAP_BADI~COMPUTE
    That is it, if you included the correct fields in the attributes and the correct infoprovider in step 2. When you use those fields in a query it will populate znumdays with your calculation.

  • How can i get number of days between two dates represented by two dates?

    how can i get number of days between two dates represented by two date objects. One is java.sql.Date, the other is java.util.Date?

    tej_222 wrote:
    But how do I do that conversion. from java.sql.date and java.util.date to calender?
    -thanks for the quick response.You may find the following utility code samples useful:
    [http://balusc.blogspot.com/2007/09/calendarutil.html]
    [http://balusc.blogspot.com/2007/09/dateutil.html]
    ganeshmb wrote:
    (date1.getTime() - date2.getTime())/(1000*60*60*24) should do.
    getTime returns millsecond value of date object and the difference divided by no of milliseconds in a day should fetch you the difference in terms of days.This doesn't respect the DST. Use java.util.Calendar.

  • Prorate absence Quota monthly based on number of days worked.

    Hi All,
    I need to Generate Absence Quota Prorated Monthly on the following criteria.
    4.5 days Per month.
    0 - 5 day = 0.5
    6-10 days = 1.5days
    11- 15 days = 2.5 days
    16-20days = 3 days
    21 - 25 = 3.5 days
    26 and above = 4.5 days
    54 Quota Yearly entitlement
    Negative Time evaluation -
    Time evaluation run at end of the month.
    If use Base Entilement as .15 / days and daily accural in Table T559L ,
    then without any PCR quota is generated but for 31 days it generates 4.65 days and people joining middle of the month is not as per the criteria mentioned above ie as per number of day worked.
    Can any one guide me with the steps and PCR's required if any.
    Thanks
    Sethu

    Hi Dinesh,
    Thanks for your response. I have already created and  assigned it in T559L. The below is the Rounding rule.
    Lower inc     Upper     Target     Rollout
    0.00000 X     0.75000      0.15000 X
    0.90000 X     1.50000      1.50000 X
    1.65000 X     2.25000      2.50000 X
    2.40000 X     3.00000      3.00000 X
    3.90000 X     4.65000      4.50000 X
    As per my earlier thread description when i make it daily accural and assign this rounding rule then for 31 days it calculates 4.65 days and for people joining middle or last week of the month it is not prorating as per the requirement,
    Thanks
    Sethu

  • "No limit" not displaying for number of days to sync email

    I recently purchased 16GB iPad w/ retina display (MD513LL) running IOS 6.0.1
    I successfully set up MS Exchange email account, but it does not give me the option of "no limit" under number of days to sync.
    I read in a few prior posts that deleting the email accounting and setting it up again works, but I tried that at least 6 times (it worked for my new iPhone 5, but not the iPad).

    I might be wrong but I don't think so because I set up the same account on my iPhone 5 which allowed for the "no limit" option.

  • How to get PO and vendor payment term number of days??

    Hi Experts,
    I want to have a) Purchase order payment term number of days as well as
    b) vendor Payment term number of days.
    For  a) For  Purchase order payment term number of days I am using table EKKO and taking ZBD1T field which is giving payment
               term number of days.
              Is it correct??
          b) vendor Payment term number of days I am using table LFB1 field Zterm to take payment term key not number of days.
               Based on this key i will go to table T052 and find corresponding number of days as told MM consultants .
               But this is not BW work. We need one single table from which we can take the field or enhance the current extractor
              with that field.
    So is there any other option for (b)
    and Whether steps for (a) is correct???
    Please confirm this.
    Thanks in Advance,
    Uday Shankar.

    For a) For Purchase order payment term number of days I am using table EKKO and taking ZBD1T field which is giving payment
    term number of days.
    Is it correct??
    Payment terms for purchasing doesn't come delivered as part of the R3/ECC tables and is usually is added as a custom field to EKKO and populated via a User Exit. That looks to be the instance in your case because the field that you show as being the payment terms begins with a Z (custom fields begin with Y or Z). That appears, without being able to actually validate in your R3/ECC environment, to be the correct field to use. You would have to validate, however, with the end customer or your MM function consultant to be 100% certain. If this is the correct one to use, you're going to have to enhance the 2LIS_02_HDR extractor by enhancing the extraction structure and creating the User Exit to read it from EKKO and populate into the DataSource.
    b) vendor Payment term number of days I am using table LFB1 field Zterm to take payment term key not number of days.
    Based on this key i will go to table T052 and find corresponding number of days as told MM consultants .
    But this is not BW work. We need one single table from which we can take the field or enhance the current extractor
    with that field.
    You can enhance the 2LIS_02_HDR extractor with the Vendor Payment Terms by joining the following in your User Exit:
    EKKO-LIFNR = LFB1-LIFNR
    EKKO-BUKRS = LFB1-BUKRS
    LFB1-ZTERM = T052-ZTERM
    This could either be done in a SELECT statement in the User Exit to do this equi join, or you could create a view on your R3/ECC environment and SELECT from that view.

  • 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

  • Credit Check on Open Items number of day

    Hi
    We have setup automatic credit control and all seems to work fine,  we now want to expandon this to include open items. So we have created a static block on open items.
    The next step was to only include open itesm that have been open for longer than 60 day, sowe have entered 60 in the number of day box.  But order are stillgoing on block due to this statoc check.
    We have 0 set in the max open items box.
    Do we need to enter anything in this box.  We want the check to only include open items older than 60 days and the credit limit not to go over the main customers credit limit
    Thanks
    Barry

    Hi,
    Could you please share the answer?
    Tawsif Chogle

  • Number of days customer is due to be maped in dunning notice PLD

    Hi All,
    In the Dunning Reprt PLD I want to print the number of days the Customer is due to company as the number of days due varries from customer to customer please give a solution. So that i want to map number of days from dunning wizard report in to the PLD.
    Regards & thanks for advance,
    Mobin.

    Hi Mobin
    One question first, the due days per customer does not make sense as there may be more than one document owing. I assume then that the oldest invoice must be used to calculate? This would be true at header level, but it will not be possible to place a field here to calculate from the rows. It might be possible to include a BP master UDF field here at print time, but this field would have to be updated manually on the BP masters with a query to get the maximum due date of open invoices and calculate their days overdue.
    For row level each document could have a number of days overdue and this should be rather easy to achieve. Add an extra column as formula field and use the following formula:
    ToNumber(F_203)-ToNumber(F_089)
    F_203 is my own hidden field at row level with the formula Date() in it. F_089 is the value date or due date on the row. You can also add a hidden field and refer to the database field you want to use for this date.
    I am still of course assuming that the dunning report you are referring to is the SAP standard dunning letter(s). If you are referring to a custom report, please let me know.
    Kind regards
    Peter Juby

  • Need to add number of days to users end date.

    Hi,
    I have a code where we are adding number of days(30) to current date and then updating user's end date in IDM DB.
    Now we have a requirement where we need to add number of days(30) to existing end date of user instead of adding to current date.
    *public String incrementDate(int daysToAdd)
         // Start date
         log.info("NotifyLastDayOfService::incrementDate(): Enter");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
         Calendar c = Calendar.getInstance();
         c.add(Calendar.DATE, daysToAdd); // number of days to add
         String newDate = sdf.format(c.getTime());
         log.info("NotifyLastDayOfService::incrementDate(): Exit");
         return newDate;
    Have any body implemented this scenario?
    Please suggest.
    Thanks,
    Kalpana.

    Hi Nayan,
    Here is the code:
    System.out.println("----inside increment date method-----");     
              HashMap<String, String> hm = new HashMap<String, String>();
              HashMap<String,Date> modifyMap=new HashMap<String,Date>();
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
              tcResultSet usrList = null;
         String enddate = null;
         hm.put("Users.Key",usrKey );
         try {
         usrList = this.usrIntf.findUsers(hm);
         usrList.goToRow(0);
         Date endDate =usrList.getDate("Users.End Date");
         System.out.println("-----users end date-----"+endDate);
         String userEndDate=sdf.format(endDate);
         System.out.println("-----String value of users end date-----"+userEndDate);
         Calendar cal=null;
         System.out.println("-----Calender date-----"+cal);
         cal.setTime(endDate);
         System.out.println("-----end date-----"+endDate);
    cal.add(Calendar.DATE, Integer.parseInt(daysToAdd)); // number of days to add
    Date newEnddate = cal.getTime();
    System.out.println("-----new end date-----"+newEnddate);
    //usrList.setEndDate(Edate);
    modifyMap.put(userEndDate,newEnddate);
    usrIntf.updateUser(usrList, modifyMap);
    System.out.println("updated user's end date in OIM DB");
    //System.out.println("-----updated user's end date in OIM DB-----");
    logger.info("NotifyLastDayOfService::incrementDate(): Exit");
         System.out.println("-----new date-----");
         } catch (tcAPIException e) {
         logger.error("Error in finding end date for user" + e);
         } catch (tcColumnNotFoundException e) {
         logger.error("Error in finding end date for user" + e);
    In th log file, I can see that the code is not executing this line:
    cal.setTime(endDate);
    end date is of type Date and stores users end date from DB. Please help in resolving this issue.
    Thakns,
    Kalpana.

  • Is it possible to add number of days to date?

    I am working on a form where I need to add number of days to a date and come up with a date.
    Header 1
    Header 2
    example date:  March 1, 2013
    + 30
    = march 31 2013                
    1. is this possible? Header1/cell 1 is a date field. Header 2/cell 1 is a dropdown field (30, 60, 90,120, custom),.
    Header2 cell2 not sure what field to use date or text?
    thank you

    Never mind I figured it out. Thanks

  • 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

  • How to avoid crosstab - Show number of days according to groups

    Morning all,
    I think you all would agree with me that even having crosstab as a great tool in Crystal 2008, there are still quite allot of limitations to it.
    I have created a report using crosstab which shows number of days and jobs according to those days grouped by account number, product code, sales area. This report is working fine until my director asked me to further group those days according to sub categories of lenses.
    For example
    Crosstab shows
    Number of days - Day 1,day 2, day 3
    Number of jobs - 111----123--1213
    Percentage - -
    12%---34% 60%
    Now if you look at the example it says day 1, 111 jobs went out. What the director would like to see is those jobs being sub divided into types of lenses.
    So out of 111 jobs, 25 would be Finished lenses, 30 could be uncut lenses and so on.
    The new report should be like this
    Number of days -
    Day1---Day2---Day3
    Number of Jobs:-
    Finished -
    25--34-----23
    Uncut--3045-----23
    AR--7056-----76
    Total----125135----122
    Percentage:-
    Finished -
    25%--34%-----23%
    Uncut--30%45%-----23%
    AR--70%56%-----76%
    Total----100%100%----100%
    Now if we look at the above criteria it seems that I have to use groups even further down the report where I am using crosstab at the moment. This means I have to get rid of the crosstab and run a report manually.
    However the big question is, how to get the report calculating number of days and jobs according to customer account number, product code and sales area manually?
    I tried the following formula but this requires to write way too many formulas, for example some of the jobs have taken more than 60 days and if i use this formula I have to write 60 formulas for number of days which is not feasable.
    **//provided by IIbas in another forum**
    whileprintingrecords;
    numbervar day0;
    numbervar day1;
    numbervar day2;
    if {@workingdays} = 0 then
    day0 := day0 + 1 else
    if {@workingdays} = 1 then
    day1 := day1 + 1 else
    if {@workingdays} = 2 then
    day2 := day2 + 1 else //up to the maximum number of days.
    Then in the report footer, reference the days in separate formulas, and identify them with text boxes, e.g.,
    //{@day0};
    whileprintingrecords;
    numbervar day0;
    I can sort out the Finished, uncut,AR by grouping them however I am wondering how to create a manual running total of jobs complying with number of days without using crosstab.
    Any ideas?
    Many thanks
    Regards
    Jehanzeb

    no answer closing

Maybe you are looking for

  • AnyConnect: No Address Available for SVC Connection on Cisco ASA 5505

    Get Error The secure gateway has rejected the connection attempt.   A new connection attempt to the same or another secure gateway is needed, which requires re-authentication.   The follow message was received from the secure gateway:    No address a

  • External monitor on Bootcamp windows 7? (IMAC)

    I am having problems with getting my external monitor to work in windows 7. It works properly with mac. It seems that the problem is that is does not detect the screen, as there is only 1 screen detected so i cannot choose a second one. I am using th

  • How to get list of customers for a particular plant.

    Hello All, I have a requirement of the customer aging analysis report where I need to get the details of the customer for a particular plant.I have searched the tables T001w and Kna1 but  found no  result for my requirement.can any body tell me how t

  • How to fix column / row as "header" in WAD (Web item Analysis) ?

    Hi, is there a possibility to fix a column or row as "header" in web item analysis? (like freeze panes in excel) When scrolling down, the header should always be displayed. Thank you very much in advance, best regards Frank

  • Txn to assign company code to material

    Hi All, While creating the material using txn (MM01) it shows error message "Company code is not setup for material management".. Regards