To get the last date of year

Can anyone tell me how to get last date of the year while passing the First date of year:
My below query is giving the last date of the month
SELECT LAST_DAY(ADD_MONTHS(TO_DATE('01/01/2012','DD/MM/YYYY'),12 -
TO_NUMBER(TO_CHAR(SYSDATE,'mm')))) FROM DUAL
Thnx in Advance

jeneesh wrote:
Last date will be always 31st december..
to_date('3112'||to_char(first_date,'yyyy'),'ddmmyyyy')
I like that !!! :)
I guess, OP will have to either Buy a New Calendar or Prepare on where the Last Day of year is not 31st December. ;)

Similar Messages

  • Please help.........how can i get the last date of the month?????

    Hello....
    I want to get the last date of the month.
    For example, the last date of Jan is 31.
    How can I get the last date of the particular month and year ????
    Thanks for help.
    Gloria

    Hi Gloria
    1. How can I compare the date???date1.compareTo(date2)
    where date1 and date2 is a java.util.Date Object
    will return 0 if it is the same date
    or
    date1.after(date2)
    where date1 and date2 is a java.util.Date Object
    will return true if date1 is after date2
    (the same for date1.before)
    2. How can I change the date format into yyyymmdd format???? I just want the year, month and date.try the java.text.SimpleDateFormat Object
    new SimpleDateFormat("yyyymmdd").format(yourdate)
    Hope this help.
    Please also have a look at a calendar I wrote, (maybe it help)
    demo & source :
    http://www.geocities.com/globe_software/java/components/
    globe_sa

  • Get the last date of a given date...

    Hello experts,
    How do I get the last date of a given date? for example:
    20060615  "June 15,2006
    So I want to get the last date of june so that will be
    20060630
    But I want to make it this way:
    06/30/2006 because I will use it in my where clause.
    Again, thanks a lot guys and take care!

    The date format should be in 'YYYYMMDD'
    data : v_last_day like sy-datum,
    v_in_date like sy-datum.
    v_in_date = '20050109'.
    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
    EXPORTING
    DAY_IN = v_in_date
    IMPORTING
    LAST_DAY_OF_MONTH = v_last_day
    * EXCEPTIONS
    * DAY_IN_NO_DATE = 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_last_day.
    Cheers
    VJ

  • How to get the last data point from a TDM file in LabVIEW?

    Hello,
    I am using LabVIEW to analyze some rather large TDM files, and I need a way to get only the last data point.  So far, the only way I have been able to accomplish this is by reading the entire file.  Is there a property in the TDM file or a function in LabVIEW that will allow me to get the index of the last item in a channel?  
    Thanks!
    Christina

    Do you want to avoid reading whole file and want to be able to reach or get the index of last value of channel? is there any specific reason? I am not sure you could do it without loading the whole file. But the easiest way would be just to use array functions "array size" would give you the index of last element. 
    -Nilesh
    Kudos are (always) welcome for the good post. :-)

  • How to Get the last data dymanic

    in my bussiness scenarios,I have a cube store some data by month
    but some material have no records in some month
    I need to check if this month have records,get it
    or if there is no records, get the last records by month
    how can i do this?

    You check in R3...whether you have material data for that month...if yopu have data, in BW, run a repair full request by giving this criteria i.e. month criteria.
    Thanks...
    Shambhu

  • How to get the last date of that month after adding the two month.

    Hi,
    I have a requirement, My input is month/lastdate of the month/year after adding 2 months i want the same format mont+2/lastdate of the month/year.
    Please let me know the exact FM for this.
    I have check this FM RE_ADD_MONTH_TO_DATE.
    Input:                                           
    Import parameters               Value    
    MONTHS                          02       
    OLDDATE                         02/29/2008
    Output:                                           
    Export parameters               Value     
    NEWDATE                         04/29/2008
    But this wrong because i am expecting the last date of the April.
    2) I have checked another FM that also also shows the wrong output: RP_CALC_DATE_IN_INTERVAL                                                
      Import parameters               Value         
      DATE                            12/31/2008    
      DAYS                            00            
      MONTHS                          02            
      SIGNUM                          +             
      YEARS                           00                                                                               
    Export parameters               Value         
      CALC_DATE                       03/01/2009    
    Thanks In avance,
    Thanks & Regards,
    Venkata

    Hi,
    do the RE_ADD_MONTH_TO_DATE then
    Plug the result date into FM RP_LAST_DAY_OF_MONTHS
    Regards
    Stu

  • Getting the last date's value

    Hello,
    I need to be able to show the last date's value for all dates where a fact measure exists.
    For example, let's say I have the following fact table:
    Date                  Category  Value
    01/01/2000       A              1
    01/02/2000       A              3
    01/03/2000       B              2
    01/05/2000       C              7
    What I need is to have a calculated measure that shows the last entry while respecting the value of the category in the slicer. So if I have no category in the slicer, the pivot table looks like this:
    Date                  Value  Calculated Measure
    01/01/2000       1         7
    01/02/2000       3         7
    01/03/2000       2         7
    01/05/2000       7         7
    But, if I have a category A in the slicer, it should look like this:
    Date                  Value  Calculated Measure
    01/01/2000       1         3
    01/02/2000       3         3

    Assuming you only have a single table in your data model like your example, this measure should work for you with Category as a row or a slicer:
    =CALCULATE(
       LOOKUPVALUE(TableName[Value],
         TableName[Date],
         MAX(TableName[Date])
       ALLEXCEPT(
           TableName,
           TableName[Category]
    Replace TableName with the actual table name.

  • Getting the last date

    Hello,
    I need to be able to show the last date's value for all dates where a fact measure exists.
    For example, let's say I have the following fact table:
    Date                  Value
    01/01/2000       1
    01/02/2000       3
    01/03/2000       2
    01/05/2000       7
    What I need is to have a calculated measure that shows the last entry, so that when I have the pivot table, it looks like this:
    Date                  Value  Calculated Measure
    01/01/2000       1         7
    01/02/2000       3         7
    01/03/2000       2         7
    01/05/2000       7         7

    Hi Kostaz,
    You could try defining a calculated column...I've called this 'Calculated Column' in my example:
    =
    CALCULATE(
    MAX(Data[Value]),
    FILTER(
    Data,
    Data[Date] = MAX(Data[Date])
    Then you can use a measure to return the MAX value:
    Calculated Measure:=MAX([Calculated Column])
    Regards,
    Michael
    Please remember to mark a post that answers your question as an answer...If a post doesn't answer your question but you've found it helpful, please remember to vote it as helpful :)

  • Report req -To get the last date

    Hi all,
    I have  one report requirement,I have to develope the report to display last movement date.
    I am able to get the all movement dates regarding the particular material.But I need to display only last date .Is any option in query designer to get last date only in report .Instead of displaying all dates like MAX of the date in our abap code.
    Thank's
    BK

    Hello Srini / Tarak
    Thank you I will try your options .But I dont have any direct keyfigure like : last movement date.
    I have to do all cal on my date characteristic only.In this regard please suggest...
    Thanks
    Bk

  • Mdx query to get the last date of every month if the month is current month need current date..

    i have a scenario where i need the data of last date of every month and if the month is current month need current date data...
    is it possible using MDX...

    Hi Shashi,
    According to your description, you want to return the last day for each month except current month, right?
    In MDX, we can use ClosingPeriod function to return the member that is the last sibling among the descendants of a specified member at a specified level, here is a sample query for you reference.
    with member [measures].[a]
    as
    ClosingPeriod ([Date].[Calendar].[Date],[Date].[Calendar].currentmember).name
    select {[measures].[a]} on 0,
    [Date].[Calendar].[Month].members on 1
    from
    [Adventure Works]
    And then use the IIF function to evaluate if the month is current month. Please refer to the links below.
    http://msdn.microsoft.com/en-us/library/ms145584.aspxhttp://msdn.microsoft.com/en-IN/library/ms145994.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • First I had the last date up and now all of a sudden stands the last date under the list of incomming emails how can I get the last date again up the list

    I hope you understand what I mean because English is not my language but Dutch.
    Example: 17-11-2014
    16-11-2014
    15-11-2014 so I recieved my e mails and now
    15-11-2014
    16-11-2014
    17-11-2014
    and I want that the newest date become up
    I hope their is someone to help me.
    Thanks.
    Heinja

    In English: ;-)
    Click on "Date" to sort by date. Click it again to reverse the sorting.
    Or, in the menu, '''View|Sort By''' and select '''Date''' and '''Ascending '''or '''Descending '''as you require. You probably want '''Unthreaded''' too.

  • Object date - how to get the last day of the month?

    hi all,
    I have a date object in which I would like to get the last day of the month. any idea?
    eg AUG=31
    Feb = 28 (depends if a leap year)
    thanks

    Use java.util.Calendar
    Add 1 month to the day.
    Set the day of month to be 1.
    Subtract 1 day.
    Now you are on the last day of the month you wanted.

  • How do I get the last changed date & time of a file in app server?

    Hi Experts,
    How do I get the last changed date & time of a file in app server?
    Thanks!
    - Anthony -

    Hi,
    that's what I use...
      CALL 'C_DIR_READ_FINISH'.             " just to be sure
      CALL 'C_DIR_READ_START' ID 'DIR' FIELD p_path.
      IF sy-subrc <> 0.
        EXIT. "Error
      ENDIF.
      DO.
        CLEAR l_srvfil.
        CALL 'C_DIR_READ_NEXT'
          ID 'TYPE'   FIELD l_srvfil-type
          ID 'NAME'   FIELD l_srvfil-file
          ID 'LEN'    FIELD l_srvfil-size
          ID 'OWNER'  FIELD l_srvfil-owner
          ID 'MTIME'  FIELD l_mtime
          ID 'MODE'   FIELD l_srvfil-attri.
    *    l_srvfil-dir = p_path .
        IF sy-subrc = 1.
          EXIT.
        ENDIF." sy-subrc <> 0.
        PERFORM p_to_date_time_tz
          USING    l_mtime
          CHANGING l_srvfil-mod_time
                   l_srvfil-mod_date.
        TRANSLATE l_srvfil-type TO UPPER CASE.               "#EC TRANSLANG
        PERFORM translate_attribute CHANGING l_srvfil-attri.
        CHECK:
          NOT l_srvfil-file = '.',
          l_srvfil-type = 'D' OR
          l_srvfil-type = 'F' .
        APPEND l_srvfil TO lt_srvfil.
      ENDDO.
      CHECK NOT lt_srvfil IS INITIAL.
      pt_srvfil = lt_srvfil.
    FORM p_to_date_time_tz  USING    p_ptime  TYPE p
                            CHANGING p_time   TYPE syuzeit
                                     p_date   TYPE sydatum.
      DATA:
        l_abaptstamp TYPE timestamp,
        l_time       TYPE int4,
        l_opcode     TYPE x VALUE 3,
        l_abstamp    TYPE abstamp.
      l_time = p_ptime.
      CALL 'RstrDateConv'
        ID 'OPCODE' FIELD l_opcode
        ID 'TIMESTAMP' FIELD l_time
        ID 'ABAPSTAMP' FIELD l_abstamp.
      l_abaptstamp = l_abstamp.
      CONVERT TIME STAMP l_abaptstamp TIME ZONE sy-zonlo INTO DATE p_date
          TIME p_time.
    ENDFORM.                    " p_to_date_time_tz
    Regards,
    Clemens

  • Different ways to get the last 5 records ordered by date

    I have a query no that returns the tickets ordered by moddt, modification date,
    I was thinking of adding a select on top, to get the last 5 records of that list the select already generates. An other way was to use that select to create a view,
    and get the 5 last records that way. I also though of a possibly impossible cursor with a sequence, but hmm well I consider that not a good solution.
    So I'm trying to find a way, using a select, the topmost select which is not completed yet, to get the last 5 records. Maybe I should just try the rownumber thing again or something likewise.
    Select * from(
    select * from(
    Select ticketid, appliecatiecd, categorieid, substr(titel,&,200)||' ...' "titel", klantproriteitid, interneprioriteitid,
    (select g.voornaam||' '||g.naam
    from gebruiker g
    Where g.gebruikerid = t.gebruikerid
    And t.applicatiecd = NVL(:P0_applicatiecd, :F101_applicatiecd))"aangemaakt door",
    (select s.statusdefoms "status"
    From status s
    Where s.statusid = t.statusid
    And t.applicatiecd = NVL(:P0_applicatiecd, :F101_applicatiecd)) "status",
    Versieid,
    Moddt,
    Row_number() over (order by ticketid desc) rn
    From ticket t
    Where applicatiecd = NVL(:P0_applicatiecd, :F101_applicatiecd) )
    Order by moddt)
    Where --

    Hi Floris,
    You can also use RANK: http://www.dba-oracle.com/oracle_news/oracle_faq/faq_beg_sql_top_n_rows.htm
    Regards Pete

  • Get the first and the last date of a week

    Hi all
    I need to get the first and the last date of a specific week.
    I need a function that returns two date passing it just one date.
    The function has to calculate the first and the last date of the week of the argument date.
    hope to be clear
    regards

    goiters,
    I need to get the first and the last date of a specific week.Yup, and what's the first day of the week in your part of the world, is it Sunday or Monday?
    I need a function that returns two date passing it just one date.No you don't, just add 7 days to the start of the week.
    hope to be clearWell, you can hope.
    Keith.
    Message was edited by: corlettk - now I hope to clear ;-)

Maybe you are looking for