retrieve the last date of the month

Hello

I give myself a date. I want to find the last date of the month containing the given date.

Is there any built-in why?

Thanks in advance.

DateTimeUtilities.getNumberOfDaysInMonth (cal.get (Calendar.MONTH), cal.get (Calendar.YEAR));

Tags: BlackBerry Developers

Similar Questions

  • To display the first and last date of one month

    I have the date format in 10 Mar 10.
    My requirement is when ever I select the date in the dashboard for all the month it should show results of all the months.
    I had the request for obiee101.blogspot.com.but if I use that sometimes it is not the latest results of the day. Any body please give me the query to display the results for the first day and lastday?
    I select any day from the drop-down menu of the guest, it must display the month of ex: if results
    If I select either 1 mar mar 10.2 10,30 mar 10...
    It should give results for the month of March.
    Can you please provide me the query for the last month also?
    If I select March date date print want to display the results of March together in a single column, results of the previous months in the other column

    Someone help me to achieve this?

    Yes, you are right. Jean SQL for the last day of the month, if the "last day of the previous month" ends on June 30, that "adding a month" will result in the 30th of the following month. But if the next month has 31 days, you don't miss this day here.

    Use it for the last day of the current month.

    TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_MONTH, 1, TIMESTAMPADD (SQL_TSI_DAY, 1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-1, CURRENT_DATE))))

    The SQL above will ensure that you will get always the last day of the month "current" no matter how many days during the previous or current month.

  • to get the last date of every month between year 2000 to 2100

    Hi all

    How we can make this last list date of every month between 2000 and 2100

    Thanks and greetings
    Vivek

    You must use the LAST_DAY() function:

    WITH months AS
    (
         SELECT      TO_DATE('01/01/2000','MM/DD/YYYY') AS dt1
         ,     TO_DATE('12/31/2100','MM/DD/YYYY') AS dt2
         FROM     DUAL
    )
    SELECT LAST_DAY(ADD_MONTHS(dt1,level-1)) LST_DAY_MONTHS
    FROM     months
    CONNECT BY LEVEL <= MONTHS_BETWEEN(dt2,dt1)+1
    

    Sample of results (too many to display):

    LST_DAY_MONTHS
    -------------------
    01/31/2000 00:00:00
    02/29/2000 00:00:00
    03/31/2000 00:00:00
    04/30/2000 00:00:00
    05/31/2000 00:00:00
    06/30/2000 00:00:00
    07/31/2000 00:00:00
    08/31/2000 00:00:00
    09/30/2000 00:00:00
    10/31/2000 00:00:00
    11/30/2000 00:00:00
    12/31/2000 00:00:00
    01/31/2001 00:00:00
    02/28/2001 00:00:00
    03/31/2001 00:00:00
    04/30/2001 00:00:00
    05/31/2001 00:00:00
    06/30/2001 00:00:00
    07/31/2001 00:00:00
    08/31/2001 00:00:00
    09/30/2001 00:00:00
    10/31/2001 00:00:00
    11/30/2001 00:00:00
    12/31/2001 00:00:00
    01/31/2002 00:00:00
    02/28/2002 00:00:00
    03/31/2002 00:00:00
    
  • Retrieve the month following the date

    Hi people,

    How can I get the part of months to a date.

    Say, like, I want to get the month part (April = 4) 01/04/2009.

    Thanks in advance!

    Hello

    You can get all parts of a DATE using TO_CHAR.
    For example, on April 1, 2009

    SELECT  TO_CHAR (SYSDATE, 'Month')
    FROM    dual;
    

    product of the results of this

    April
    

    (if you use English) and

    SELECT  TO_CHAR (SYSDATE, 'MM')
    FROM    dual;
    

    produces this output (VARCHAR2)

    04
    
  • How to get the last date of 3 days for the current month?

    Hello. Guy

    How to get the last date of 3 days for the current month?

    MY OUTPUT WOULD LOOK LIKE THIS

    JANUARY 29, 2016

    JANUARY 30, 2016

    JANUARY 31, 2016


    GUYS HELP ME / / /...

    SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">

    LAST_DAY)

    ---------

    29 JANUARY 16

    30 JANUARY 16

    31 JANUARY 16

  • Breaking a year in coming weeks of beginning and end Dates (parameters) and first and last day of the month

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    SELECT first_thursday + (7 * (LEVEL - 1))   AS week_start_date,
                     first_thursday + (7 * LEVEL) - 1    AS  week_end_date
    FROM
    (
      SELECT TRUNC(p_from_date + 4, 'IW') - 4   AS first_thursday, -- Week should start the pre ceeding THURSDAY based on the Start Date
                      TRUNC( p_to_date + 4,  'IW') - 5     AS last_wednesday
      FROM
      (
        SELECT to_date('01-JAN-2013') AS p_from_date,
                        NVL(to_date('31-DEC-2013'), SYSDATE) AS p_to_date
        FROM     dual
      ) parms
    ) end_points
    CONNECT BY LEVEL <= ( last_wednesday + 1 - first_thursday)/7;
    

    Currently, this is the result I get (I'm only including the months of January and December here).

    Week_Start_Date     Week_End_Date
    27-DEC-12                02-JAN-13
    03-JAN-13                 09-JAN-13
    10-JAN-13                 16-JAN-13
    17-JAN-13                 23-JAN-13
    24-JAN-13                 30-JAN-13
    31-JAN-13                 06-FEB-13
    

    December:

    28-NOV-13               04-DEC-13
    05-DEC-13              11-DEC-13
    12-DEC-13              18-DEC-13
    19-DEC-13              25-DEC-13
    

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    01-JAN-13              02-JAN-13
    03-JAN-13              09-JAN-13
    10-JAN-13             16-JAN-13
    17-JAN-13             23-JAN-13
    24-JAN-13             30-JAN-13
    31-JAN-13             31-JAN-13
    

    February:

    01-FEB-13    06-FEB-13
    07-FEB-13    13-FEB-13
    14-FEB-13    20-FEB-13
    21-FEB-13    27-FEB-13
    28-FEB-13    28-FEB-13
    

    November:

    31-OCT-13    06-NOV-13
    07-NOV-13    13-NOV-13
    14-NOV-13    20-NOV-13
    21-NOV-13    27-NOV-13
    28-NOV-13    04-DEC-13
    

    December:

    01-DEC-13           04-DEC-13
    05-DEC-13           11-DEC-13
    12-DEC-13          18-DEC-13
    19-DEC-13          25-DEC-13
    26-DEC-13          31-DEC-13
    

    Hello

    Roxyrollers wrote:

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    1. First_thursday SELECT + (7 * (LEVEL - 1)) AS week_start_date,
    2. first_thursday + (7 * LEVEL)-1 AS week_end_date
    3. Of
    4. (
    5. SELECT TRUNC (p_from_date + 4, 'IW') - 4 AS first_thursday,-week should start to perform the pre-mounted THURSDAY based on the Start Date
    6. TRUNC (p_to_date + 4, 'IW') - 5 AS last_wednesday
    7. Of
    8. (
    9. SELECT to_date('01-JAN-2013') AS p_from_date,
    10. NVL (to_date('31-Dec-2013'), SYSDATE) AS p_to_date
    11. OF the double
    12. ) parms
    13. ) end_points
    14. CONNECT BY LEVEL<= (="" last_wednesday="" +="" 1="" -="">

    Currently, this is the result I get (I'm only including the months of January and December here).

    1. Week_Start_Date Week_End_Date
    2. DECEMBER 27, 12 2 JANUARY 13
    3. JANUARY 3, 13 JANUARY 9, 13
    4. 10 JANUARY 13 JANUARY 16, 13
    5. 17 JANUARY 13 23 JANUARY 13
    6. 24 JANUARY 13 30 JANUARY 13
    7. 31 JANUARY 13 FEBRUARY 6, 13

    December:

    1. NOVEMBER 28, 13 4 DECEMBER 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    1. JANUARY 1, 13 2 JANUARY 13
    2. JANUARY 3, 13 JANUARY 9, 13
    3. 10 JANUARY 13 JANUARY 16, 13
    4. 17 JANUARY 13 23 JANUARY 13
    5. 24 JANUARY 13 30 JANUARY 13
    6. 31 JANUARY 13 JANUARY 31, 13

    February:

    1. 1ST FEBRUARY 13 FEBRUARY 6, 13
    2. 7 FEBRUARY 13 FEBRUARY 13, 13
    3. 14 FEBRUARY 13 FEBRUARY 20, 13
    4. 21 FEBRUARY 13 FEBRUARY 27, 13
    5. 28 FEBRUARY 13 FEBRUARY 28, 13

    November:

    1. 31 OCTOBER 13 NOVEMBER 6, 13
    2. 7 NOVEMBER 13 NOVEMBER 13, 13
    3. 14 NOVEMBER 13 NOVEMBER 20, 13
    4. 21 NOVEMBER 13 NOVEMBER 27, 13
    5. NOVEMBER 28, 13 4 DECEMBER 13

    December:

    1. 1ST DECEMBER 13 DECEMBER 4, 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13
    5. 26 DECEMBER 13 DECEMBER 31, 13

    Why the "weeks" in November, have all 7 days, while the "weeks" in the first or the last week in the other month usually have less?  (For example, February 28 is a 'week' alone.)

    The following works for the other months:

    WITH all_days AS

    (

    SELECT DATE "2013-01-01' + LEVEL - AS a_date 1

    OF the double

    CONNECT BY LEVEL<=>

    )

    SELECT DISTINCT

    More GRAND (TRUNC (a_date + 4, 'IW') - 4)

    , TRUNC (a_date, 'MONTH')

    ) AS week_begin

    , The LEAST (TRUNC (a_date + 4, 'IW') + 2

    TRUNC (LAST_DAY (a_date))

    ), Week_end

    Of all_days

    ORDER BY week_begin

    ;

    Output:

    WEEK_BEGIN WEEK_END

    ----------- -----------

    January 1, 2013 January 2, 2013

    January 3, 2013 January 9, 2013

    January 10, 2013 January 16, 2013

    January 17, 2013 January 23, 2013

    January 24, 2013 January 30, 2013

    January 31, 2013 January 31, 2013

    February 1, 2013 February 6, 2013

    February 7, 2013 February 13, 2013

    February 14, 2013 February 20, 2013

    February 21, 2013 February 27, 2013

    February 28, 2013 February 28, 2013

    ...

    November 1, 2013 November 6, 2013

    November 7, 2013 November 13, 2013

    November 14, 2013 November 20, 2013

    November 21, 2013 November 27, 2013

    November 28, 2013 November 30, 2013

    December 1, 2013 December 4, 2013

    December 5, 2013 December 11, 2013

    December 12, 2013 December 18, 2013

    December 19, 2013 December 25, 2013

    26 December 2013 31 December 2013

  • Get the date of each month in the last year

    Hi all

    I need to find the last date of the month for the year.

    Example:

    I used to spend the date or such year 2012 or 01-01-2012(DD-MM-YYYY)

    SQL query should return the last date of the month as

    31/01/2012

    28/02/2012

    31/03/2012

    30/04/2012

    .

    .

    .

    .

    .

    12/31/2012

    For more top the requirement that I wrote the SQL code following

    select rownum as row_count,
    case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Jan_month,
    case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Feb_month,
    case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as mar_month,
    case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as apr_month,
    case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as may_month,
    case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jun_month,
    case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jul_month,
    case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as aug_month,
    case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as sep_month,
    case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as oct_month,
    case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as nov_month,
    case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as dec_month
    
    
    from dual connect by level <= 12 order by rownum;
    
    
    
    
    

    Result

    Jan_MonthFeb_MonthMar_MonthApr_Monthmay_monthjun_monthjul_monthaug_monthsep_monthoct_monthnov_monthdec_month
    131/01/2014
    228/02/2014
    331/03/2014
    430/04/2014
    531/05/2014
    630/06/2014
    731/07/2014
    831/08/2014
    930/09/2014
    1031/10/2014
    1130/11/2014
    1212/31/2012

    Except the result:

    am result except as single line such as

    Jan_MonthFeb_MonthMar_MonthApr_Monthmay_monthjun_monthjul_monthaug_monthsep_monthoct_monthnov_monthdec_month
    31/01/201228/02/201231/03/201230/04/201231/05/201230/06/201231/07/201231/08/201230/09/201210/31/201230/11/201212/31/2012

    Kindly give me suggestion to archive more high result.

    Thanks and greetings

    Saami

    I agree with Marcus Pivot is the way to go on this subject... But on the other hand you almost solved yourself... it was just a max function for your results:

    ---------

    select
    max(case  when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Jan_month,
    max(case  when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Feb_month,
    max(case  when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as mar_month,
    max(case  when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as apr_month,
    max(case  when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as may_month,
    max(case  when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jun_month,
    max(case  when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jul_month,
    max(case  when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as aug_month,
    max(case  when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as sep_month,
    max(case  when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as oct_month,
    max(case  when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as nov_month,
    max(case  when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as dec_month
    from dual connect by level <= 12 order by rownum;
    

    AND to avoid hard-coding, you can also modify your query in the form:

    select
    max(case  when rownum=1 then last_day(to_date(to_char(rownum),'MM')) end) as Jan_month,
    max(case  when rownum=2 then last_day(to_date(to_char(rownum),'MM')) end) as Feb_month,
    max(case  when rownum=3 then last_day(to_date(to_char(rownum),'MM')) end) as mar_month,
    max(case  when rownum=4 then last_day(to_date(to_char(rownum),'MM')) end) as apr_month,
    max(case  when rownum=5 then last_day(to_date(to_char(rownum),'MM')) end) as may_month,
    max(case  when rownum=6 then last_day(to_date(to_char(rownum),'MM')) end) as jun_month,
    max(case  when rownum=7 then last_day(to_date(to_char(rownum),'MM')) end) as jul_month,
    max(case  when rownum=8 then last_day(to_date(to_char(rownum),'MM')) end) as aug_month,
    max(case  when rownum=9 then last_day(to_date(to_char(rownum),'MM')) end) as sep_month,
    max(case  when rownum=10 then last_day(to_date(to_char(rownum),'MM')) end) as oct_month,
    max(case  when rownum=11 then last_day(to_date(to_char(rownum),'MM')) end) as nov_month,
    max(case  when rownum=12 then last_day(to_date(to_char(rownum),'MM')) end) as dec_month
    from dual connect by level <= 12 order by rownum;
    

    Easy way: (without login)

    SELECT LAST_DAY (TO_DATE (ROWNUM, 'MM')) AS Jan_month,
           LAST_DAY (TO_DATE (ROWNUM + 1, 'MM')) AS Feb_month,
           LAST_DAY (TO_DATE (ROWNUM + 2, 'MM')) AS Mar_month,
           LAST_DAY (TO_DATE (ROWNUM + 3, 'MM')) AS Apr_month,
           LAST_DAY (TO_DATE (ROWNUM + 4, 'MM')) AS May_month,
           LAST_DAY (TO_DATE (ROWNUM + 5, 'MM')) AS Jun_month,
           LAST_DAY (TO_DATE (ROWNUM + 6, 'MM')) AS Jul_month,
           LAST_DAY (TO_DATE (ROWNUM + 7, 'MM')) AS Aug_month,
           LAST_DAY (TO_DATE (ROWNUM + 8, 'MM')) AS Sep_month,
           LAST_DAY (TO_DATE (ROWNUM + 9, 'MM')) AS Oct_month,
           LAST_DAY (TO_DATE (ROWNUM + 10, 'MM')) AS Nov_month,
           LAST_DAY (TO_DATE (ROWNUM + 11, 'MM')) AS Dec_month
      FROM DUAL
    

    See you soon,.

    Manik.

  • Extract the first and the last Date of the previous month

    This seems to be a delicate but again it is perhaps easy for some of you people.

    Here is how I find the previous month

    Any ideas on how to get the first and last date of the previous month?

    Thanks in advance.

    Hello!

    SQL>
    SQL> select last_day(add_months(sysdate,-1)) from dual;
    
    LAST_DAY
    --------
    28.02.10
    
    SQL> select trunc(add_months(sysdate,-1),'MM') from dual
    
    TRUNC(AD
    --------
    01.02.10
    
    SQL> 
    

    T

  • Select records based on the monthly anniversary date

    Hello

    I have a table with a field of date_added and I want to select records from monthly birthday of this field.

    for example. ID, Date_added
    1, DECEMBER 10, 2012
    2, 11 NOVEMBER 2012
    3, 10 MARCH 2012
    4, FEBRUARY 28, 2012
    5, 30 DECEMBER 2012

    So for January 10, 2013, I would like to return the documents 1 and 3 only

    I started watching the extract function, but this little falls down to the records at the end of the month. For example, on 28 February, I also include records where 29, 30 or 31 is the day of date_added. So, in the above table, I won't return documents 4 and 5, but retrieves only returns 4.

    Is there a simple function to make the request of birthday this month - have I missed something very obvious? Or I have to write a query to explicitly dates at the end of the month? So far I have not found a reasonable solution!

    I use 11g

    Thank you

    user11259857 wrote:
    Hi Al,.

    No I don't think that there is a flaw. For example, the 30 Jan is not the last day of the month, but is June 30. Thus, on 30 January I want only to interrogate all the dates falling on the 30th - 28 February, after already being interrogated on the 28 Jan. However, on 30 June, I would query the 30th of each month, as well as the 31 January, March, may, July, Aug, Oct, dec. February is a special case, being both shorter and a leap year

    Thank you

    Richard

    Hi Richard,

    so, we can assume that your needs are:

    If the day is the last day of that month, interview the day of the other months being > = day of the current month.

    That is to say:

    Jan-30 = query only 30 other months
    Jan-31 = query only 31 of the other months

    Feb-28 (non-leap years) = question 28, 29, 30 and 31 other months
    29 February (leap year) = query 29,30,31 to other months

    Mar-30 = query only 30 other months
    Apr-30 = query 30 and 31 other months

    This hypothesis is correct?

    If so, then something like this should work:

    WITH mydates(id, date_added) AS
    (
       SELECT 1, TO_DATE('10-DEC-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL
       SELECT 2, TO_DATE('11-NOV-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL
       SELECT 3, TO_DATE('10-MAR-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL
       SELECT 4, TO_DATE('28-FEB-2012', 'DD-MON-YYYY') FROM DUAL UNION ALL
       SELECT 5, TO_DATE('30-DEC-2012', 'DD-MON-YYYY') FROM DUAL
    )
    SELECT id, date_added
      FROM mydates
     WHERE (:input_date = LAST_DAY(:input_date) AND TO_CHAR(:input_date,'DD') <= TO_CHAR(date_added, 'DD'))
        OR TO_CHAR(:input_date,'DD') = TO_CHAR(date_added, 'DD');
    
    with input_date = 28/02/2013
    
    id   date_added
    4    28/02/2012
    5    30/12/2012
    

    Kind regards.
    Al

    Published by: Alberto Faenza on 10 January 2013 15:21
    Added example

  • Retrieve the time WITHOUT the current date

    Hi, I would like to retrieve only the current system time.

    If I use the System.currentTimeMillis (), I'll be able to retrieve the date and time and have long value of it since 1970. Is it possible to get the current time from the beginning of the day? Or at least format after I have recover time current time system?

    Maybe I can get the time current system in milliseconds, and then subtract the date in milliseconds of her current system? Are there more simpler way?

    Please help me! Thanks in advance!

    That's what I mean:

    long ldate = System.currentTimeMillis();
    String date = new SimpleDateFormat("dd.MM.yyyy").format(new Date(ldate));
    
    helpint = Integer.parseInt(date.substring(6));
    calendar.set(Calendar.YEAR, helpint);
    helpint = Integer.parseInt(date.substring(3, 5));
    calendar.set(Calendar.MONTH, helpint-1);
    helpint = Integer.parseInt(date.substring(0, 2));
    calendar.set(Calendar.DAY_OF_MONTH, helpint);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    long startTime = calendar.getTime().getTime();
    
    int diffinmillis = ldate - starttime;
    
  • Select the last record of each month

    Hello

    to select the last docnumber and qty of every month

    Structure

    Name Null?    Type

    ------------------------------- -------- ----

    PRODUCTCODE NUMBER

    NUMBER NUMBER

    DATE OF PLANFORMONTH

    NUMBER OF CLEXPECTEDQTY

    NUMBER OF CLCONFIRMQTY

    NUMBER OF CLFGBUFFERQTY

    NUMBER OF CLTOTPRINTBUFFER

    in this select query if I take the sum he required all records where, as I want the last record of each month

    SELECT productcode docnumber MAX (Number), planformonth, SUM (clexpectedqty) clexpectedqty (planformonth) MAX.

    SUM (clconfirmqty) clconfirmqty, SUM (clfgbufferqty) clfgbufferqty, cltotprintbuffer OF FGSALESPLAN of the SUM (cltotprintbuffer)

    GROUP BY productcode, (planformonth)

    Sandy

    Hello

    Thanks its working now the code is written as below:

    SELECT * FROM

    (SELECT

    e.*,

    ROW_NUMBER() OVER (partition by PRODUCTCODE by DOCNUMBER DESC order) r

    Of

    E FGSALESPLAN)

    WHERE r = 1 AND

    entryvalid = 'Y '.

    order by Number

    Sandy

  • Hi all, please help me to retrieve the last record value in field

    Hi all

    Shape the table below, I want to retrieve the latest data from column 4 disks in a new field that will be my field of view as shown in the end of the table by means of BI publisher, please help to achieve this goal.

    Column1 2 3 4 5 6

    May 1, 1067205671982868062
    May 1, 10034925706902868065
    15 May 102500005456901634220
    15 June 106000000-543101657501

    New field -54310

    Thank you and best regards,

    Prasad.

    something like

    for each: ByWhichLoop [last()]

    end foreach

  • Get the last day of the month

    Hello

    How can I get the (day number of the) last day of a given month and year?

    So, if

    year 2015 = and month = 1, the output should be 31

    year = 2012 and month = 2 while production is expected to be 29

    year 2013 = and month = 2 while production is expected to be 28

    etc.

    Y at - it no OBIEE to achieve? If not, then a command SQL Oracle is very good too (I prefer OBIEE however)

    Thanks in advance,

    Erik

    You start from the first day of the month, you add 1 month [TIMESTAMPADD (SQL_TSI_MONTH, 1, 'your date')], you must subtract 1 day [TIMESTAMPADD (SQL_TSI_DAY,-1, 'your date')] and use the DAYOFMONTH function to get the number of the last day of the month [DAYOFMONTH ('your ' date')].

    All these calls nesting together and you're there.

  • Select the query to select the month range based on the current date.

    It's the database 10 g oracel.

    I want to choose two months of data in the table. But these two months should be based on the current date.

    For example.

    If I run the select query on July 7, 2013, then the query must ignore the current month being July 2013 and last month, which is June 2013 and it shoud select only may 2013 and April 2013.

    Can someone help me how to make this request.

    SELECT *.

    FROM my_table

    WHERE my_date > = TRUNC (ADD_MONTHS (sysdate,-3), 'MY') - first day of the month 3 months ago

    AND my_date< trunc(add_months(sysdate,-1),'mon')="" --="" first="" day="" of="" last="">

  • First date of the month

    Hi experts,

    Please let me know how to get registered for the 1st of the month by using the query, after passing a date in the query:

    My queries below give me 1 license of the year and the last date of the month... Kindly hep...
    SELECT TRUNC(TO_DATE('24-JUN-2011'),'YEAR') FROM DUAL
    
    SELECT LAST_DAY(ADD_MONTHS('24-JUN-2011',12 - 
    TO_NUMBER(TO_CHAR(SYSDATE,'mm')))) FROM DUAL
    Help appreciated,

    Thnx in advance
    TRUNC(TO_DATE('24-JUN-2011'),'MM')
    

    And he always will be always 1... ;)

Maybe you are looking for

  • Satellite A100-02 b PSAAR: trick to be able to save for the multi monitor users

    Hi, people I always use an external as extension of office monitor when I connect my Tosh to AC.And I just found out, when I plug it all and go truly mobile, the graphics card still provides a signal to the VGA Port for the then nonexistent extern mo

  • BlackBerry® Classic EMAIL, SMS, no warning your same under Normal profile

    There is no alert tone for E-mail, SMS and other text messages received even under Normal profile. How to activate the same

  • How to install on windows face recognition software 8

    I downloaded the facial recognition for HP protect tools on the site of hp, but while that install shows a command prompt he needs HP protect Tools Security Manager, so I downloaded as well (HP protect Tools Security Manager v.8.0.1.1328) but while i

  • RH11 Webhelp full-text research question

    I built a project for several months. A year ago, we went from RH9 to RH11 without any problem. We just found out that there are now problems with full-text search. Survey shows anything loaded before a month ago back in the search, but whatever it i

  • Lightroom DNG bug 6

    Hello everyone,I just found a bug (it's a bug to me) in LR6. When I convert RAW Dng files, LR6 apparently saves the development parameters in the DNG format.My files from 2014, all published with LR5, do not contain these parameters. These are normal