Getting Start and End Date of Current Year?

Hi Folks,
How do I get the start of the year and end of the year in Java ?
If I say :
Calendar cal = Calendar.getInstance();
int day = cal.get(Calendar.DATE);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
System.out.println("Day: " + day);
System.out.println("Month: " + month);
System.out.println("Year: " + year);
I get the current day and time.What I need is the start of the current Year (Jan 2010) and the End of the Current Year (Dec 2010).
How can get the above 2 dates if I the current date is March 24th 2010 ?
Thanks

sabre150 wrote:
What am I missing? The start date of 2010 is 1/1/2010 and the end data is 31/12/2010 . So, as I see it, at any time the only information you need is the current year which you currently get from int year = cal.get(Calendar.YEAR);
Well, with the GregorianCalendar, anyway. ;-)

Similar Messages

  • FM to get start and end date when given month

    Hi all,
       can anybody help me if there a FM to get start and end date when given month like 01 for jan.
    Thanks in advance
    Sahitya

    Hi,
    Check this Function Module
    HR_JP_MONTH_BEGIN_END_DATE
    here if you r giving the month u wil get the start date and the end date.
    Hope this helps you.
    Thanks & regards,
    Y.R.Prem Kumar

  • Function module to derive start and end dates from fiscal year and period.

    Hi,
    I want to know a function module to derive start and end dates from fiscal year and period.
    ie: If I have say fiscal year '2010' and period '07', then the start date of this period would be '01.10.2010'.
    Thanks.
    Moderator Messge: Basic Date questions are not allowed.
    Edited by: kishan P on Oct 18, 2010 4:45 PM

    Hi,
    This is one of my exit that display the calmonth (offset -12). Usefull when I have to retrieve in a KF a complete rolling year depending one calmonth.
    S_VMUCMN is my selection variable
    S_TXTCMN_M12 is my text variable calmonth-12
    S_TXTCMN_M0 is my text variable for selected calmonth.
    WHEN 'S_TXTCMN_M12'.
        IF i_step = '2'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'S_VMUCMN'.
            CLEAR l_s_range.
            " First day of the selected month
            CONCATENATE loc_var_range-low '01' INTO l_calday.
            CALL FUNCTION 'YFRBW_FUM_CAL_DATE_IN_INTERVAL'
              EXPORTING
                date      = l_calday
                months    = 12
                signum    = '-'
              IMPORTING
                calc_date = l_calday.
            l_s_range-low = l_calday+0(6).
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    Thus, in KF header you have to put the two text variable to display the complete period.
    Hope it helps,

  • Query to find the start and end date of current quarter

    I want a query to give me the start date and end date of current quarter
    I don't want to use TRUNC and ROUND as the 16th day roundoff logic is not required.
    Thanks in advance.

    Hi ,
    I'm quite sure that the year quarters are static.....
    So , you can save them as records of a table , such as:
    QRTY START_DAY END DAY
    ============================
    1 1/1 30/3
    2 1/4 30/6
    3 1/7 30/9
    4 1/10 31/12
    The sysdate(day of the current quarter) must be between a start_day and appropriate end_day of the quarters, concatenated with the sysyear (year of the sysdate).
    So , if the above table is called Quarters ...
    then
    select start_day , end_day
    from quarters
    where to_date(sysdate,'dd/mm/rrrr') between (to_date(trim((start_day||'/'||to_char(sysdate,'rrrr'))),'dd/mm/rrrr'))
    and (to_date(trim((end_day||'/'||to_char(sysdate,'rrrr'))),'dd/mm/rrrr'));
    [b]Result
    START_DAY END_DAY
    1/10 31/12
    Regards,
    Simon
    Message was edited by:
    sgalaxy
    Message was edited by:
    sgalaxy

  • Text Variables to show Start and End Date of Fiscal Year Period

    Hi,
    I am creating a query that has user enter a starting fiscal year period and posts information by Fiscal Year Period going back 14 periods.  I am able to put the fiscal year period in the heading for all periods, but would also like to add the start and end calendar day for each listed period.  Can that be done using a replacement path text variable or is that something more for a customer exit variable?
    Thanks in advance for any thoughts provided.
    Bill

    Hi,
    This is one of my exit that display the calmonth (offset -12). Usefull when I have to retrieve in a KF a complete rolling year depending one calmonth.
    S_VMUCMN is my selection variable
    S_TXTCMN_M12 is my text variable calmonth-12
    S_TXTCMN_M0 is my text variable for selected calmonth.
    WHEN 'S_TXTCMN_M12'.
        IF i_step = '2'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'S_VMUCMN'.
            CLEAR l_s_range.
            " First day of the selected month
            CONCATENATE loc_var_range-low '01' INTO l_calday.
            CALL FUNCTION 'YFRBW_FUM_CAL_DATE_IN_INTERVAL'
              EXPORTING
                date      = l_calday
                months    = 12
                signum    = '-'
              IMPORTING
                calc_date = l_calday.
            l_s_range-low = l_calday+0(6).
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    Thus, in KF header you have to put the two text variable to display the complete period.
    Hope it helps,

  • How to get Start and End date

    Hi All,
    I need to get the start date and end date of a month by passing parameter like 'MAy-2011'
    Result should be start date - 01-MAY-2011 and end date - 31-MAY-2011
    thnxs

    I did the documentation drill down for you :
    http://tahiti.oracle.com/
    http://www.oracle.com/pls/db112/homepage?remark=tahiti
    http://www.oracle.com/pls/db112/portal.all_books
    http://www.oracle.com/pls/db112/portal.all_books#index-SQL
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions.htm#i1482196
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions002.htm#i88891
    from here on you should be able to find a solution on yout own.

  • Get start and end date for posting period (YYYYMMM format)

    In revenue recognition I'd like to have the start date and the end date of the posting period, which is in format YYYYMMM. It's field VBREVR-BDJPOPER.
    Any idea?
    I had no luck so far to find a relevant FM.
    Thanks in advance,
    Peter

    Hi,
    Use this FM To convert the date into DD.MMM.YYYY format
    <b>CONVERSION_EXIT_SDATE_OUTPUT</b>.
    Use the followiong FM To convert the date into <b>user specified</b> format
    <b>SLS_MISC_CONVERT_TO_DATE</b>     
    Rewaed if helpful.
    Regards,
    Sandhya

  • First date and last date of current year

    Hi
    how can i get first and last date of current year, thanks for your help

    hi,
    use FM......... FIRST_AND_LAST_DAY_IN_YEAR_GET
    DATA: first LIKE sy-datum,
          last LIKE sy-datum.
    CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
      EXPORTING
        i_gjahr     = '2007'
        i_periv     = '24'
      IMPORTING
        e_first_day = first
        e_last_day  = last.
    WRITE: / 'First Date', first, '    Last Date', last.
    Regards
    CNU

  • How to input my own Validity Start and End Dates in ME21N

    Hi All,
    I have to change the Validity Start and Validity End date in Addiitional Data Tab of ME21 transaction( PO Create ) using default Customer Values.How Can i accomplish it?
    I have used the BAdI ME_PROCESS_PO_CUST and implemented it, I have coded in the method PROCESS_HEADER.First I retrieved the data using get_data( ) method, changed the values with Customer Values and called the method set_data( ).
    However my validity start and End Dates and not changing.
    Even in ME21N if I create the PO with my own Validity Start and End dates, and go to ME23N to display the created PO, still in the additional data tab, the start and End dates are current date and Next date respectively.why its happening?
    Thanks in advance

    Hi,
    Can you please let us know in which business scenario this is required.
    SAP has provided separate functionality of Outline Agreement for considering validity period.
    If you let us know the business scenarion some solution/workaround can be suggested.
    Regards

  • Hyperion Planning dynamic forms based on start and end date across years

    Hi All,
    I have a requirement where i need to be able to view a form showing periods across years that are dynamically built depending on the start and end dates. If i have a start date of 01/11/2009 and an end date of 31/7/2013 i want to be able to view a form that shows all of the periods (Jan,Feb etc) in a form that is driven by these dates, in addition it will need to show the actual scenario up to the current month and the forecast from the current month to the end date. So basically if a user inputs the start and end dates the form will display the relevant periods driven by these dates.
    Any tips very much appreciated!

    Hello,
    This is difficult to realize, but you can get quite far with a workaround. The first question is, where do you want to input your selection of time periods? Assuming you have a webform with the complete timeline in months and years and you type in the start period and end period.
    Webforms have the option to suppress rows and columns.
    This can be extended with option of empty cells or not empty cells.
    You will need to apply your creativity on this.
    Put every month-year combination in a column and add the suppression.
    Calculate the timeline between start period and end period with a dummy member, so data exists for these and columns will show.
    Maybe you will need to copy the required timeline into a separate version for this, to avoid having periods which were outside the selection and still have data.
    I hope these hints help a bit in this challenge.
    Regards,
    Philip Hulsebosch
    www.trexco.nl

  • How to determine current period start and end dates

    Hi All,
    If given previous period start date and end date, how to determine current period start date and end date?
    Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
    Can you please suggest an FM to determine the current period dates?
    Thanks & Regards
    Gowthami

    >
    gowthami karunya wrote:
    > If given previous period start date and end date, how to determine current period start date and end date?
    > Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
    Hello,
    I am assuming you have the Company Code with you & proposing this solution.
    TABLES: bkpf.
    PARAMETERS:
    p_bukrs TYPE bukrs.
    SELECT-OPTIONS:
    s_date FOR bkpf-budat.
    DATA :
    l_perio LIKE bkpf-monat,
    l_poper TYPE poper,
    l_year  LIKE bkpf-gjahr,
    l_spmon TYPE spmon,
    l_periv TYPE periv,
    l_date1 TYPE datum,
    l_date2 TYPE datum.
    CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
      EXPORTING
        companycodeid = p_bukrs
        posting_date  = s_date-high
      IMPORTING
        fiscal_year   = l_year
        fiscal_period = l_perio.
    CONCATENATE l_year l_perio INTO l_spmon.
    * Get the next period
    IF l_perio < 12.
      l_perio = l_perio + 1.
    ELSE.
      l_perio = '01'.
      l_year = l_year + 1.
    ENDIF.
    MOVE l_perio TO l_poper.
    SELECT SINGLE periv INTO l_periv
    FROM t001
    WHERE bukrs = p_bukrs.
    IF sy-subrc = 0.
      CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = l_periv
          i_poper        = l_poper
        IMPORTING
          e_date         = l_date1
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = l_periv
          i_poper        = l_poper
        IMPORTING
          e_date         = l_date2
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      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: / l_date1, l_date2.
    ENDIF.

  • Getting the start  and end dates of the week

    Hi,
    I was stuck with a problem in getting the start date and end date of the week,i know the month ,week and year also,with these three values how can i get the start and end dates of a week.please help me
    Thanks

    There is no simple way. It has to be a math calculation.
    There are several ways you can get the dates. First you have to know what day is January 1st and what day is december 31st for a particular year. Second you have to check whether the given year is a leap year or not. Based on the abvove information you should be able to find out what day is a particular date.
    Hope this helps to get you started.
    - Venkat Dhurjati.

  • PowerShell - Get-MessageTrackingReport how to specify start and end time of current process

    could you please help me? I need to specify start and end time of current process with Get-MessageTrackingReport command. I know you
    can do it with Get-MessageTrackingLog:
    $start = (Get-Date).Addhours(-1)
    $end = (Get-Date)
    Get-MessageTrackingLog -EvenId Receive -Start $start -End $end
    But for my purposes I really need to do it with Get-MessageTrackingReport command, so how can I do it?
    Thanks in advance!

    That's not the context you would use
    Get-MessageTrackingReport in,
    Get-MessageTrackingReport is used to get extra information on messages that you have found in the MessageTracking log using Search-MessageTrackingReport . That's why the most common example you see will look like
    $Temp = Search-MessageTrackingReport -Identity "David Jones" -Recipients "[email protected]"
    Get-MessageTrackingReport -Identity $Temp.MessageTrackingReportID -ReportTemplate Summary
    The most important parameter for that cmdlet and the reason it won't work like your trying to use it is the
    Identity ""The Identity parameter specifies the ID of the message tracking report ID to retrieve.You should run the Search-MessageTrackingReport cmdlet
    to find the message tracking report ID for the specific message you're tracking, and then pass the value of the MessageTrackingReportID field
    to this parameter." see http://technet.microsoft.com/en-us/library/dd351082%28v=exchg.150%29.aspx
    It's more appropriate to use Get-MessageTrackingLog when you want to search the log based on time or use
    Search-MessageTrackingReport and then limit the results this returns before you pass the MessageTrackingReportId to get-MessageTrackingReport
    Cheers
    Glen

  • Survey questionaire disappearing when updating the start date and end date to previous year

    Hi Experts
    When the start and end dates are updated to the previous year dates the questionaire is disappearing from the assignment block, is this a standard behaviour or this is a bug which needs to be raised to SAP.
    Please advise.
    Appreciate for a quick response as this is quiet urgent.
    Regards
    AM

    Hi AM,
    Check the SAP Note 1629777 - SVY: Survey becomes invalid if the from date < sysdate
    This should resolve the issue.
    Regards,
    Gervase

  • Function module to find start date and end date of fiscal year for company

    Hi,
    Is there any function module exist which will provide me start date and end date of fiscal year for company code and fiscal year provided?
    Thanks & Regards,
    Parag

    Hi,
    please check this link
    it would be very useful
    http://www.sapdevelopment.co.uk/fmodules/fms_fiscalyr.htm
    Thanks and regards
    durga.K

Maybe you are looking for

  • Trouble connecting my pc and printer

    I installed all my kodak all in one printer software and its showing that the printer is set up but I'm not able to print anything out.

  • Unable to open pfds as I am told it is not a valid win32 application.

    I am able to open a pdf if I right click and choose a program to open the pdf but if I just double click the error .pfd is not a valid win32 application apprears. How can I fix this Cheers

  • Generate excel sheet list file through program

    Hi, I have to generate list in excel which is having column with fixed length. I m using classical report for output then in output i m generating excel file . but that file is not with fixed column length. how ALV will be useful in this case Please

  • How to show display attributes like key and description in voyager

    This question is on voyager connecting to SAP BI Query. I would like to show both key and description of the row member. It is mentioned in the guide that display attributes can be viewed and changed from the properties tab of the tab panel. But I di

  • Is this some kind of joke?

    [URL=http://www.speedtest.net][IMG]http://www.speedtest.net/result/929000707.png[/IMG][/URL] Seriously? Why does this ISP suck so much, i would love to change but can't because i don't have the money to break the stupid contract. I don't think i've e