Calculate Months from Field Date

Using: Acrobat X Pro in windows. 
I have three fields:
1) Today's Date:___________ [DateToday] -- Automatically filled-in with today's date using script.
2) Date Last Payment Made:__________ [LastPaymentMade1] -- Filled-in by user in mm/dd/yyyy format.
3) Months Since Last Payment:______________ [MoBehind] -- Need to calculate from field 1 - 2).
For #3, how do I custom calculate how many MONTHS it has been (#3) since the date the last payment was made (#2)?
There's a great discussion here on this topic but I cannot figure out how to modify the script for my purposes: http://forums.adobe.com/message/1907993#1907993
This appears to be the closest thing to what I want:
function Floor(fValue) {
return Math.floor(fValue);
function Date2Num(sDate, sFormat) {
var fSecond =1000;
var fMinute = 60 * fSecond;
var fHour = 60 * fMinute;
var fDay = 24 * fHour;
var oDate = util.scand(sFormat, sDate);
var fDate = oDate.valueOf();
var fDate = fDate / fDay;
var fDate = Floor(fDate);
return fDate;
var Start = this.getField("DateToday").value;
var sFormat = "mm/dd/yyyy";
var End = this.getField("LastPaymentMade1").value;
var sFormat = "mm/dd/yyyy";
var eFormat = sFormat;
event.value = Date2Num(End, eFormat) - Date2Num(Start, sFormat);
Here's another one that looks SIMILAR to what i want:
(function () {
    // Get date from field
    var v = getField("DateToday").value;
    if (v) {
        // Convert string to date
        var d = util.scand('mm/dd/yyyy', v);
        // Add number of days in NUMDAYS field
        d.setDate(d.getDate() - +getField("NumDays").value);
        // Set value of this field to the new date
        event.value = util.printd("mm/dd/yyyy", d);
    } else {
        // Blank field if no date entered
        event.value = "";

Since the number of days in a month are not constant across a year I do not think you can use the milliseconds in a day.
I you use the 'getMonth()' and 'getFullYear()' methods for the calculation.
// get the date values
var Start = this.getField("DateToday").value;
var sFormat = "mm/dd/yyyy";
var End = this.getField("LastPaymentMade1").value;
var sFormat = "mm/dd/yyyy";
var eFormat = sFormat;
// convert to date object
var oStart = util.scand(sForamt, Start);
var oEnd = util.scand(eFormat, End);
// get start month
var StartMonth = oStrat.getMonth();
// add start full year as months
StartMonth = StartMonth + (oStart.getFullYear() * 12);
// get end month
var EndMonth = oEnd.getMonth();
// add end full year as months
EndMonth = EndMonth + (oEnd.getFullYear() * 12);
// compute difference in months
var diffMonths = EndMonth - StratMonth;

Similar Messages

  • Get the month from a date column with the calculated column

    I am trying to get the month from a date field with the help of calculated column. However I get this syntax error whenever I want to submit the formula:
    Error 
    The formula contains a syntax error or is not supported. 
    the default language of our site is German and [datum, von] is a date field.

    Hi,
    I have created two columns
    Current MM-YY
    Calculated (calculation based on other columns)
    Today
    Date and Time
    Current MM-YY is calculated value with formula as
    =TEXT(Today,"mmmm")
    But the output shows as December instead of May.
    I have tried =TEXT([Datum, von];"mmmm") but no help.
    I am trying to populated the column automatically with current month..ex: if its May the field should show May, next month it should show June an so on.
    Any kind help is grateful.
    Regards,
    Pradeep

  • How to get name of the month from current date.

    Hi,
       How to get the name of the month from current date.
    Thanks,
    Senthil

    Sethil,
    Use your date(let us say Date1) instead of sy-datum.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    TABLES
    MONTH_NAMES = itab_month
    EXCEPTIONS
    MONTH_NAMES_NOT_FOUND = 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.
    READ TABLE itab_month
    WITH KEY MNR = date1+4(2).
    itab_month-LTX will contain the value you are looking for
    Good luck
    Raghava

  • URL in lieu PH consumed within 3 months from the date of PH

    Hi friends
    I achieved Unrecorded leave in lieu of PH,through writing PCR but i am having another doubt..This URL in lieu of PH has to be consumed within 3 months from the date of public holiday,how to achieve this??any suggestions from u friends???
    Thanks&best regds
    Shaila

    I have asked a moderator to provide assistance, they will post an invite on this thread.
    They are the only BT employees on this forum, and are a UK based team of people, who take personal ownership of your problem.
    Once you get a reply, make sure that you are logged into the forum, then click on their name, you will see a screen like this. Click on the link as shown below.
    Please do not send them a personal message, as they cannot deal with service issues that way.
    For your own security, do not post any personal details, on this forum. That includes any tracking number you are give.
    They will respond either by phone or e-mail, when its your turn in the queue.
    Please use the tracked e-mail, to reply, not via the forum. Thanks
    This is the form you should see when you click on the link. If you do not see this form, then you have selected the wrong link.
    When you submit the form, you will receive an enquiry number, so please keep a note of it
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • Subtracting months from current date

    how to subtract months from current date in mysql

    You are in an Oracle forum, so the Oracle answer is: use add_months(sysdate,-2) to subtract two months from the current date.
    Regards,
    Rob.

  • Get last august month from current date

    Hi,
    I need to get last august month from current date.
    e.g if current date is 1-OCT-2013 need to get last August date i.e.1-AUG-2013
    e.g. if current date is 1-MAY-2013 need to get last August date i.e.1-AUG-2012

    Something like this?
    SQL> WITH table_x AS(
      2     SELECT SYSDATE dt from dual UNION ALL
      3     SELECT TO_DATE('20-05-2013','dd-mm-yyyy') from dual
      4  )
      5  --
      6  ---
      7  --
      8  SELECT  dt,
      9    CASE
    10      WHEN (dt >= Add_Months(TRUNC(dt,'YEAR'),7)) THEN
    11          Add_Months(TRUNC(dt,'YEAR'),7)
    12      WHEN (dt < Add_Months(TRUNC(dt,'YEAR'),7)) THEN
    13          Add_Months(TRUNC(dt,'YEAR'),7) - 365
    14    END cs
    15  FROM table_x;
    DT        CS
    24-OCT-13 01-AUG-13
    20-MAY-13 01-AUG-12

  • Calculations for 6 months from todays date

    Need to calculate the total of all the months starting from today's date for the next 6 months from the current date.
    For ex
    Month              Total
    01.07.2008         10
    01.08.2008         20     
    01.09.2008         50          
    01.10.2008         72
    01.11.2008         85
    01.12.2008         15
    Please advice how to work on this.
    Can we use ranges?
    Thanks in advance.

    Hi dolly,
    Ref this code.....
    TYPE-POOLS  :
                  slis.
    TABLES      :
                  pernr.
    INFOTYPES   :
                  0000,
                  0001,
                  0002.
    TYPES       :
                  BEGIN OF t_final,
                    srlno  TYPE i,                "Serial No
                    pernr  TYPE p0000-pernr,      "Employee No
                    vorna  TYPE p0002-vorna,      "First Name
                    nachn  TYPE p0002-nachn,      "Last Name
                    btrtl  TYPE p0001-btrtl,      "PERSONAL SUB AREA / SEGMENT
                    btext  TYPE t001p-btext,      " SEGMENT DESC
                    begda  TYPE p0000-begda,      " JOINING DATE
                    pdate  TYPE p0000-begda,      " Probation period date.
                  END OF t_final,
                  BEGIN OF t_t001p,
                    btrtl TYPE t001p-btrtl,
                    btext TYPE t001p-btext,
                  END OF t_t001p.
    DATA        :
                  v_year(4) TYPE n,
                  v_year1 TYPE i,
                  count   TYPE i,
                  v_mont(2) TYPE n,
                  v_dt(2) TYPE n,
                  v_date(8),
                  it_final TYPE STANDARD TABLE OF t_final,
                  it_temp  TYPE STANDARD TABLE OF t_final,
                  it_t001p TYPE STANDARD TABLE OF t_t001p,
                  wa_t001p TYPE t_t001p,
                  wa_temp  TYPE t_final,
                  wa_final TYPE t_final.
    ALV Grid Declarations                                               *
    DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
           wa_fieldcat LIKE LINE OF it_fieldcat,
           wa_layout TYPE slis_layout_alv,
           it_sortcat TYPE slis_t_sortinfo_alv,
           wa_sortcat LIKE LINE OF it_sortcat.
    START-OF-SELECTION.
      PERFORM fill_itabs.
    GET pernr.
      rp-provide-from-frst p0000 space '18000101' '99991231'.
      IF pnp-sw-found = 1.
        IF p0000-stat2 = 3.    " Checking for status.
          MOVE  :
                p0000-begda TO wa_temp-begda,
                p0000-pernr TO wa_temp-pernr.
          rp-provide-from-last p0001 space pnpbegda pnpendda.
          IF pnp-sw-found = 1.
            MOVE  :
                    p0001-btrtl TO wa_temp-btrtl.
            CLEAR : wa_t001p.
            READ TABLE it_t001p INTO wa_t001p WITH KEY btrtl = wa_temp-btrtl.
            IF sy-subrc = 0.
              MOVE : wa_t001p-btext TO wa_temp-btext.
            ENDIF.
          ENDIF.
          rp-provide-from-last p0001 space pnpbegda pnpendda.
          IF pnp-sw-found = 1.
            MOVE  :
                    p0002-vorna TO wa_temp-vorna,
                    p0002-nachn TO wa_temp-nachn.
          ENDIF.
          APPEND wa_temp TO it_temp.
          CLEAR : wa_temp.
        ENDIF.  "if p0000-stat2 = 3.
      ENDIF.  "if pn-sw-found = 1.
    END-OF-SELECTION.
      PERFORM process_data.
      PERFORM build_catalog.
      PERFORM display_data.
    *&      Form  PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM process_data .
      LOOP AT it_temp INTO wa_temp.
        IF wa_temp-begda+4(2) >  6.
          v_year = wa_temp-begda(4) + 1.
          v_mont = wa_temp-begda+4(2) + 6.
          v_dt   = wa_temp-begda+6(2).
          IF WA_TEMP-BEGDA+4(2) = '08'.
            IF wa_temp-begda+6(2) = '29' OR
               wa_temp-begda+6(2) = '30' OR
               wa_temp-begda+6(2) = '31'.
              v_dt = '28'.
            ENDIF.
          ENDIF.
            IF v_mont > 12.
              v_mont = v_mont - 12.
              CONCATENATE v_year v_mont v_dt INTO v_date.
              MOVE : v_date TO wa_temp-pdate.
            ENDIF.
          ELSE.
            v_mont = wa_temp-begda+4(2) + 6.
            CONCATENATE wa_temp-begda(4) v_mont wa_temp-begda6(2) INTO v_date.
            wa_temp-pdate = v_date.
          ENDIF.
          MODIFY it_temp FROM wa_temp .
          CLEAR : v_date, v_year, v_mont.
        ENDLOOP.
        LOOP AT it_temp INTO wa_temp WHERE pdate BETWEEN pnpbegda AND pnpendda.
          MOVE : wa_temp-pernr TO wa_final-pernr,
                 wa_temp-vorna TO wa_final-vorna,
                 wa_temp-nachn TO wa_final-nachn,
                 wa_temp-begda TO wa_final-begda,
                 wa_temp-btrtl TO wa_final-btrtl,
                 wa_temp-btext TO wa_final-btext.
          CASE wa_temp-pdate+4(2).
            WHEN '04' OR '06' OR '09' OR '11'.
              IF wa_temp-pdate+6(2) > '30'.
                CONCATENATE wa_temp-pdate(4) wa_temp-pdate4(2) '30' INTO v_date.
                MOVE : v_date TO wa_final-pdate.
              ELSE.
                MOVE wa_temp-pdate TO wa_final-pdate.
              ENDIF.
            WHEN '02'.
              v_year1  = wa_temp-pdate+(4) MOD 4.
              IF v_year1 = 0 AND wa_temp-pdate+6(2) > '29'.
                CONCATENATE wa_temp-pdate(4) wa_temp-pdate4(2) '29' INTO v_date.
                MOVE : v_date TO wa_final-pdate.
              ELSEIF v_year1 NE 0 AND wa_temp-pdate+6(2) > '28'.
                CONCATENATE wa_temp-pdate(4) wa_temp-pdate4(2) '28' INTO v_date.
                MOVE : v_date TO wa_final-pdate.
              ELSE.
                MOVE wa_temp-pdate TO wa_final-pdate.
              ENDIF.
            WHEN OTHERS.
              MOVE wa_temp-pdate TO wa_final-pdate.
          ENDCASE.
          count = count + 1.
          MOVE : count TO wa_final-srlno.
          APPEND wa_final TO it_final.
          CLEAR : wa_final, v_year1 , v_date.
        ENDLOOP.
      ENDFORM.                    " PROCESS_DATA
    *&      Form  BUILD_CATALOG
    FORM build_catalog .
      DEFINE m_fieldcat.
        add 1 to wa_fieldcat-col_pos.
        wa_fieldcat-fieldname = &1.
        wa_fieldcat-tabname = 'IT_FINAL'.
        wa_fieldcat-seltext_m = &2.
        wa_fieldcat-outputlen = &3.
        append wa_fieldcat to it_fieldcat.
      END-OF-DEFINITION.
      m_fieldcat 'SRLNO' 'S No' '8' .
      m_fieldcat 'PERNR' 'Employee No' '15'.
      m_fieldcat 'VORNA' 'First Name' '15' .
      m_fieldcat 'NACHN' 'Last Name' '15' .
      m_fieldcat 'BTRTL' 'Segment' '15' .
      m_fieldcat 'BTEXT' 'Segment Desc' '15' .
      m_fieldcat 'BEGDA' 'Date of Joining' '15'.
      m_fieldcat 'PDATE' 'Probation End Date' '15' .
    ENDFORM.                    " BUILD_CATALOG
    *&      Form  DISPLAY_DATA
    FORM display_data .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
       is_layout = ls_layout
          it_fieldcat = it_fieldcat
       it_sort = it_sortcat
      TABLES
        t_outtab = it_final.
    ENDFORM.                    " DISPLAY_DATA
    *&      Form  FILL_ITABS
    FORM fill_itabs .
      SELECT btrtl
             btext
          FROM t001p
          INTO TABLE it_t001p.
    ENDFORM.                    " FILL_ITABS

  • Gathering data from entire month, from a date within that month

    hello, i have the following code
    select 'Shipped Amount' Descrip,(SELECT ROUND(sum(line_item_amount),2) from v_bi_invoiced_sales
    where client='PROD' and mat_type='CAST'
    and to_char(trunc(invoice_date),'YYYYMM')= TO_CHAR(TO_DATE(:P1_FROM_DATE,'MM/DD/YY'),'YYYYMM')) as Monthly,
    (SELECT sum(line_item_amount) from v_bi_invoiced_sales
    where client='PROD' and mat_type='CAST'
    and to_char(trunc(invoice_date),'YYYY')= TO_CHAR(TO_DATE(:P1_FROM_DATE,'MM/DD/YY'),'YYYY')) as Yearly
    from dualI have a different report that has only one date field, and i want to find whatever total montly shipping from whatever date is entered. Example: today is march 26th, and if this is entered, i want to find all this shipping from march 1st, 2010 through date. Another example: if Jan 6th, 2010 is entered, i want the entire month of Jan2010 shipping in the monthly shipping field displayed.
    thanks
    Corey

    select sum(nvl(total_invoice_amt,0)) from a_invoice_header
    where client ='PROD'
    and invoice_date between :p1_date('01-'||to_char(:p1_date,'MON-RR'),'DD-MON-RR') and last_day(:p1_date)and BILLING_DOC_TYPE ='IN'my ":p1_date" is a date displayed from the date picker (use application format mask) and its source is:
    SELECT TRUNC(SYSDATE) FROM DUALso it is basically the system date, i change everything to :p1_date and am still getting:
    ORA-01403: no data found
    Error ERR-1020 Error in PLSQL item processing (function).
    OK
    corey

  • How to get previous 2 months from current date in a dropdown?

    Hello Experts ,
                           In the application which I am developing, there is a requirement wherein , I want to Populate current month and previous two month in a drop down depending upon today's date. please help.
    Thanks & Regards,
    Pratbha Shukla

    The internal format for dates is yyyymmdd.  Therefore you can just grab the month value from the date:
    data lv_month type FCMNR.
    lv_month = lv_date+4(2).
    Just subtract from the month to get the two previous.
    data lv_previous1 type FCMNR.
    data lv_previous2 type FCMNR.
    if lv_month = 1.
    lv_previous1 = '12'.
    else.
    lv_previous1 - lv_month - 1.
    endif.
    if lv_previous1 = 1.
    lv_previous2 = '12'.
    else.
    lv_previous2 - lv_previous1 - 1.
    endif.
    Then do your lookup for the month name by reading the table returned from function module MONTH_NAMES_GET.

  • Defaulting date 3 months from present date

    HI!
    In my selection screen in my report I need to default a
    selection option to a future date which is 3 months from the
    present date. Can anyone tell me whats the way to do this so
    that I can add 3 montsh from the present date and default it in my selection screen.
    example : if we consider todays date  then we need to
    default that date to 9th of september 2008 so it keeps of
    changing everyday as dates proceed.
    Thanks

    Check the below program :
    REPORT ZTEST78 .
    data v_fdate type d.
    CALL FUNCTION 'HR_PSD_DATES_ADD_MONTHS'
      EXPORTING
        V_DATE             = sy-datum
       V_MONTHS           = 3
    IMPORTING
       E_DATE             = v_fdate
    EXCEPTIONS
      NOT_POSITIVE       = 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:/ v_fdate.
    do not add 90 days ,some months may have 31 or 29 or 28,you will not get exact calculation,so use FM 'HR_PSD_DATES_ADD_MONTHS'
    Thanks
    Seshu
    Thanks
    Seshu

  • Calculate age from a date on numbers

    I am trying to calculate age from a given date in the application numbers. The dates are all in the same column but i need to convert them to ages. I have not been able to find any formulas!
    Thanks

    Hi,
    DATEDIF is a good place to start:
    This example is from the Function help in Numbers, I claim no credit for it.

  • How to extract month from given date in bpel??

    Hi friends hi need some information  regarding dates in BPEL.. Here in these I taking date as input which type is also date type.Then required output is month in number format.. Here I  used Assign activity and in assign activity,I took month-from-date and passed argument to this function.But it raised an error "internal Xpath error" Any one can you give me ideas please....

    First convert you date into datetime and then use the month-from-datetime function.
    Regards,
    Anshul

  • Function to list the month from a date range?

    I would like to know what the function is that would take a look at a date range, and extract the month name
    Here is how I would like it to come out:

    Hello
    The following sample tables are along your original scheme using month name to filter the data.
    2014 (excerpt)
    A1  month
    A2  =MONTHNAME(MONTH(B2))
    A3  =MONTHNAME(MONTH(B3))
    A4  =MONTHNAME(MONTH(B4))
    B1  date
    B2  2013-01-15
    B3  2013-01-20
    B4  2013-01-27
    C1  category
    C2  A
    C3  B
    C4  C
    D1  amount
    D2  100
    D3  50
    D4  20
    January
    A1  category
    A2  A
    A3  B
    A4  C
    A5  D
    A6  E
    A7  F
    A8  G
    A9  H
    B1  totals
    B2  =SUMIFS(2014::D,2014::A,C$1,2014::C,A2)
    B3  =SUMIFS(2014::D,2014::A,C$1,2014::C,A3)
    B4  =SUMIFS(2014::D,2014::A,C$1,2014::C,A4)
    B5  =SUMIFS(2014::D,2014::A,C$1,2014::C,A5)
    B6  =SUMIFS(2014::D,2014::A,C$1,2014::C,A6)
    B7  =SUMIFS(2014::D,2014::A,C$1,2014::C,A7)
    B8  =SUMIFS(2014::D,2014::A,C$1,2014::C,A8)
    B9  =SUMIFS(2014::D,2014::A,C$1,2014::C,A9)
    C1  January
    C2 
    C3 
    C4 
    C5 
    C6 
    C7 
    C8 
    C9 
    Notes.
    Formula in January::B2 can be filled down across B2:B9.
    The target month name is defined in January::C1.
    February table is the same as January table except for the value in C1.
    And the following sample tables are using date per se instead of month name to filter the data. In this scheme, you don't need month column in source table but the retrieving formulae in destination table become more complex.
    2014 (excerpt)
    A1  date
    A2  2013-01-15
    A3  2013-01-20
    A4  2013-01-27
    B1  category
    B2  A
    B3  B
    B4  C
    C1  amount
    C2  100
    C3  50
    C4  20
    January
    A1  category
    A2  A
    A3  B
    A4  C
    A5  D
    A6  E
    A7  F
    A8  G
    A9  H
    B1  totals
    B2  =SUMIFS(2014::C,2014::B,A2,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B3  =SUMIFS(2014::C,2014::B,A3,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B4  =SUMIFS(2014::C,2014::B,A4,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B5  =SUMIFS(2014::C,2014::B,A5,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B6  =SUMIFS(2014::C,2014::B,A6,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B7  =SUMIFS(2014::C,2014::B,A7,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B8  =SUMIFS(2014::C,2014::B,A8,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B9  =SUMIFS(2014::C,2014::B,A9,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    C1  2013-01-01
    C2 
    C3 
    C4 
    C5 
    C6 
    C7 
    C8 
    C9 
    Notes.
    Formula in January::B2 can be filled down across January::B2:B9.
    The target month is defined in January::C1, which can be any date in target month, e.g., 2013-01-01, 2013-01-20, etc. The formulae in B will retrieve data with date in range: 2013-01-01 <= [date] <= 2013-01-31.
    February table is the same as January table except for the value in C1.
    Tables are built in Numbers v2.
    Hope this may help,
    H
    EDIT: Replaced the last table with the correct one. (Formulae in B are correct)

  • How to - get first DAY of the month from the date ?

    Hi
    pls help

    hi,
    data : DAYNR LIKE HRVSCHED-DAYNR,
    DAYTXT LIKE HRVSCHED-DAYTXT.
    data langu like sy-langu value 'EN'.
    Parameters PDATE LIKE SY-DATUM.
    PDATE+6(02) = '01'.
    CALL FUNCTION 'RH_GET_DATE_DAYNAME'
    EXPORTING
    LANGU = LANGU
    DATE = PDATE
    CALID =
    IMPORTING
    DAYNR = DAYNR
    DAYTXT = DAYTXT
    DAYFREE =
    EXCEPTIONS
    NO_LANGU = 1
    NO_DATE = 2
    NO_DAYTXT_FOR_LANGU = 3
    INVALID_DATE = 4
    OTHERS = 5
    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 :/ PDATE, DAYNR, DAYTXT.
       (OR)
    Try..
    DATA:DAYNR  LIKE  HRVSCHED-DAYNR,
         DAYTXT LIKE  HRVSCHED-DAYTXT,
         DAYFREE LIKE  HRVSCHED-NODAY.
    DATA:LANGU LIKE  SY-LANGU ,
         DATE LIKE  SY-DATUM,
         CALID LIKE  P1027-CALID VALUE 'US'.
    date = sy-datum.
    date+6(2) = 01.           "----->to get the first day .
    *first day of the month
    write:/ 'First date of the month', date.
    *Day name
    CALL FUNCTION 'RH_GET_DATE_DAYNAME'
      EXPORTING
        langu                     = SY-LANGU
        date                      = DATE
        CALID                     = CALID
    IMPORTING
       DAYNR                     = DAYNR
       DAYTXT                    = DAYTXT
       DAYFREE                   = DAYFREE
    EXCEPTIONS
       NO_LANGU                  = 1
       NO_DATE                   = 2
       NO_DAYTXT_FOR_LANGU       = 3
       INVALID_DATE              = 4
       OTHERS                    = 5
    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:/ DAYTXT.
    Don't forget to reward if useful....

  • SQL Query find month/year and then calculate difference from start date

    Hi All,
    Assume I have a table with a column Start_Date. I like to know how we can build a query to so we can find the end of the month date based on the start_ date and then calculate the difference
    For example lets say we have a date 12/06/2014 and now based on this we should get the end of the month date which is 30/06/2014. Now we can get the difference which is 18 days.
    Thanks

    Hi Jaggy99,
    According to your description, you need to get the date difference between a given date and the last day of that month, right?
    In this case, please try the query below.
    SELECT GETDATE() AS [CURRENTDAY], DATEADD(DAY,-1,DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0)) AS [LASTDAY],
    DATEDIFF(DAY, GETDATE (), DATEADD(DAY,-1,DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0))) AS [DIFFERENCE]
    Regards,
    Charlie Liao
    TechNet Community Support

Maybe you are looking for

  • Jsf: Detail data keep stale

    Hello! I'm developing a master-detail page using JSF (JDeveloper 10.1.3.). I want to get version as "Master table, Detail table". When I have just moved only necessary table components on the page, it worked nice. However, then I tried to add a comma

  • Regular Expressions (Pattern/Matcher) --- Help

    Hi, I have an regex i.e. Pattern.compile("([0-9])D([0-9])'?(?:([0-9]+)\")?([NSEW])").{code} It has to exactly match the input e.g *45D15'34"N* I need to retrieve the values based on grouping. Group1 = 45 (degree value) Group2 = 15 (minutes value) Gro

  • Camera Window for Android not available in my Country

    Hi everyone, Ive just bought a new G16. One of the most important features that made my pay more than 100 over the G15 is of course  the added wifi capability. But I happen to live in Argentina, and Camera Window app is not available for my country i

  • Updatable View issue

    I have created a view on 10g as follows: CREATE OR REPLACE VIEW xx_aff_vw AS SELECT * FROM xx_aff UNION ALL SELECT * FROM xx_aff_arc In the above case both xx_aff and xx_aff_arc have same columns and there are no primary or foreign keys. Only non uni

  • Defining the color index (populate the color palette with custom colors in an orderly manner)

    Hi, In Excel 2003 I used the following lines (see BELOW) to populate my color palate (in an orderly manner) with custom colors. It appears that these commands did not make the migration to Excel 2013. Could someone please help me with the fix. THANX