How to get the last business day of the previous month?

Hi all

We need the user as below,

If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks

Note:

use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?

TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))

Thank you

Deva

Try this,

case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end

As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.

Thank you

AJ

Tags: Business Intelligence

Similar Questions

  • How to get the previous month and year accordingly

    Hi friends,
    I wanted to select the month as a number like 4 and the new year 2011
    but I want to choose the previous month from sysdate
    as if the sysdate is June 10, 2011
    It should give me 5 months and
    in the year, it should give as 2011
    If the sysdate is January 1, 2012
    the month should be like 12 and year should be in 2011

    Thank you

    Hello

    776317 wrote:
    Thank you very much I just the 0 being the prefix... can you pls how to avoid that too well pls

    TO_CHAR ( ADD_MONTHS (SYSDATE, -1)
            , 'FMmm yyyy'
           )
    

    For more information on the FM, wee manual SQL language modifier works:
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/sql_elements004.htm#sthref456

  • How to get the Date, month, year of the DateTimePicker

    Hi, I am using the DateTimePicker.

    There are several question about this command:

    1. how to get the Date, month and year?

    -With the help of myDateTime.value, I get this string ' Wed May 08 14:45 ICT 2013 '-> I have to manually analyze this? Because I need in format yyyy/mm/dd. Or can set the format of dateTimePicker.value?

    2 format on dateTimePicker self (on the user interface) is d/m/YY, I can't change to another format?

    Thank you

    dateTimePicker.value return a QDateTime not a string.

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__datetimepicker.html#property-value

    See more:

    https://developer.BlackBerry.com/Cascades/reference/QDateTime.html#date

    https://developer.BlackBerry.com/Cascades/reference/QDate.html

    You can get

    day = dateTimePicker.value.date().day()
    month = dateTimePicker.value.date().month()
    year= dateTimePicker.value.date().year()
    dateYYYYMMDD = dateTimePicker.value.date().toString(Qt::ISODate)
    dateYYYYMMDD2 = dateTimePicker.value.date().toString("YYYY/MM/DD")
    dateYYYYMMDD3 = dateTimePicker.value.toString("YYYY/MM/DD")
    
  • How to get the previous motnh

    Hi Experts,

    Can someone tell me to get the previos months beginning and end date...

    If m 20-dec-2012 then output should be 1 November 2012 and November 30, 2012...

    Thnx in advance...

    977490 wrote:
    Hi Experts,

    Can someone tell me to get the previos months beginning and end date...

    If m 20-dec-2012 then output should be 1 November 2012 and November 30, 2012...

    Thnx in advance...

    Use

    select trunc(trunc(sysdate,'MM')-1,'MM') "First Day of Last Month",
    trunc(sysdate,'MM')-1
    "Last Day of Last Month" from dual
    

    20-dec-2012

    Select TRUNC (trunc (to_date (20-dec-2012', 'mon-dd-yyyy'), "LUN")-1, 'MY')
    "First day of the month pr."
    trunc (to_date (20-dec-2012', 'mon-dd-yyyy'), "LUN")-1
    "Last day of the previous month.
    of the double

    Published by: Rahul India on January 24, 2013 14:37

  • How to get the previous record that meets a criterion?

    Hello!

    I am trying to create a query that adds information which finally fixed an element for a given 'pause'.

    I have a table, let's call it actionHistory, which looks like:

    ID | timestamp | action | author
    ------------------------------------------------
    101477 | 2010-05-10 09:10:20 | Difficulty | Tim
    101477 | 2010-05-10 09:10:30 | change | John
    101477 | 2010-05-10 09:10:40 | breaking | Maggie
    101477 | 2010-05-10 09:10:50 | Difficulty | Rick
    222222 | 2010-05-10 09:10:30 | change | Lewis
    222222 | 2010-05-11 09:10:40 | breaking | Maggie
    222222 | 2010-05-11 09:10:50 | Difficulty | Tim
    222222 | 2010-05-12 09:10:40 | Difficulty | Maggie
    222222 | 2010-05-13 09:10:40 | breaking | Albert

    I'm looking for is the following result:

    ID | timestamp | action | author | lastFixBy
    -----------------------------------------------------------
    101477 | 2010-05-10 09:10:20 | Difficulty | Tim |
    101477 | 2010-05-10 09:10:30 | change | John |
    101477 | 2010-05-10 09:10:40 | breaking | Maggie | Tim
    101477 | 2010-05-10 09:10:50 | Difficulty | Rick |
    222222 | 2010-05-10 09:10:30 | change | Lewis |
    222222 | 2010-05-11 09:10:40 | breaking | Maggie |
    222222 | 2010-05-11 09:10:50 | Difficulty | Tim |
    222222 | 2010-05-12 09:10:40 | Difficulty | Maggie |
    222222 | 2010-05-13 09:10:40 | breaking | Albert | Maggie

    Can you tell me how I can make?
    I tried many ways but no return to what I'm looking for.

    Thanks in advance.

    Published by: user8910765 on June 5, 2010 13:51

    Published by: user8910765 on June 5, 2010 14:00

    Hello

    That's what you asked for in Oracle 10:

    SELECT       a.*
    ,       CASE
               WHEN  action = 'break'
               THEN  LAST_VALUE ( CASE
                                    WHEN  action = 'fix'
                                    THEN  author
                                   END
                                   IGNORE NULLS
                               ) OVER ( PARTITION BY  id
                                               ORDER BY      tmstmp
                                    )
           END        AS lastfixby
    FROM       actionhistory         a
    ORDER BY  id
    ,            tmstmp
    ;
    

    Like all of the built-in functions, LAST_VALUE is documented in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions073.htm#sthref1508

    user8910765 wrote:
    ... just in case where it might be useful, one of the queries I've tried myself a left subquery joined that Oracle has no right ("a column may be outside not attached to a subquery').

    Much more, it would help if you posted the request.
    It looks like you were using the old outer join notation (+). You can get the desired results by using an outer join with ANSI rating, but I think it would be more complicated and slower than with a LAST_VALUE.

  • How to get the previous week from Monday to Sunday from sysdate

    for example, sysdate is 15-SEP-07 We must retrieve the data from SEPT. 01.-15-06 - SEP - 2015, although 31 August 15 is Monday our application must ignore since the current month is September

    SQL> with t
      2  as
      3  (
      4  select to_date('07-SEP-15', 'dd-mon-rr') my_sysdate
      5    from dual
      6  )
      7  select greatest(trunc(my_sysdate, 'iw') - 7, trunc(my_sysdate, 'month')) start_date
      8       , trunc(my_sysdate, 'iw') - 1 end_date
      9    from t;
    
    START_DAT END_DATE
    --------- ---------
    01-SEP-15 06-SEP-15
    
  • How to get the previous group on XML element

    My XML structure goes like this.

    <? XML version = "1.0" encoding = "UTF-8"? >
    < SA321 >
    PT BOOK < P_BOOK > < / P_BOOK >
    < P_YEAR > 2009 < / P_YEAR >
    < LIST_G_FAMILY >
    < G_FAMILY >
    < PARENT_FAMILY > 2240 < / PARENT_FAMILY >
    < FAM_CODE_DESC > Cruiser informatico < / FAM_CODE_DESC >
    < SUBTOT_FLAG > Y < / SUBTOT_FLAG >
    < NEW_USED > NEW < / NEW_USED >
    < LIST_G_ASSET >
    < G_ASSET >
    < ASSET_DESCR > 2240 - Cruiser informatico < / ASSET_DESCR >
    < ACQUISITION_YEAR > 2009 < / ACQUISITION_YEAR >
    JANUARY < EFFECTIVE_MONTH > < / EFFECTIVE_MONTH >
    < EFFECTIVE_YEAR > 2009 < / EFFECTIVE_YEAR >
    < ASSET_AMOUNT > 3000 < / ASSET_AMOUNT >
    < EXEMPT_GAIN_AMOUNT > 450 < / EXEMPT_GAIN_AMOUNT >
    < EXPECTED_LIFE_YRS / >
    < PRV_FY_NBV > 0 < / PRV_FY_NBV >
    < RATES_DEC > 37.5 < / RATES_DEC >
    < RATE_FROM_LAW > 50 < / RATE_FROM_LAW >
    < RATES_DEC1 / >
    < 1 > 0 < / 1 >
    < FISCAL_LIMIT > 1275 < / FISCAL_LIMIT >
    < DEPRN_RATE > 25 < / DEPRN_RATE >
    < PY_DEPRN_RESERVE > 0 < / PY_DEPRN_RESERVE >
    < YTD_DEPRN > 749.99 < / YTD_DEPRN >
    < ACCUM_DEPRN > 749.99 < / ACCUM_DEPRN >
    < NET_BOOK_VALUE > 2250.01 < / NET_BOOK_VALUE >
    < YTD_IMPAIRMENT > 0 < / YTD_IMPAIRMENT >
    < IMPAIRMENT_RESERVE > 0 < / IMPAIRMENT_RESERVE >
    < ACCUM_LOST_RATES > 0 < / ACCUM_LOST_RATES >
    < DEPR_REINT_LOSS_NOTEXP > 0 < / DEPR_REINT_LOSS_NOTEXP >
    < GAIN_AMOUNT > 600 < / GAIN_AMOUNT >
    < GAIN_YEAR > 2006 < / GAIN_YEAR >
    < > 110270 ASSET_ID < / ASSET_ID >
    < > 110270 ASSET_ID < / ASSET_ID >
    < REINT_NOT_ACC > 437.5 < / REINT_NOT_ACC >
    < PY_COL15 > 0 < / PY_COL15 >
    < LIST_G_COL15 >
    < G_COL15 >
    < COL15_TOT > 0 < / COL15_TOT >
    < COL16_TOT / >
    < COL_16 > 0 < / COL_16 >
    < / G_COL15 >
    < / LIST_G_COL15 >
    < / G_ASSET >
    < G_ASSET >
    < ASSET_DESCR > 2240 - Cruiser informatico < / ASSET_DESCR >
    < ACQUISITION_YEAR > 2009 < / ACQUISITION_YEAR >
    JUNE < EFFECTIVE_MONTH > < / EFFECTIVE_MONTH >
    < EFFECTIVE_YEAR > 2009 < / EFFECTIVE_YEAR >
    < ASSET_AMOUNT > 1500 < / ASSET_AMOUNT >
    < EXEMPT_GAIN_AMOUNT > 0 < / EXEMPT_GAIN_AMOUNT >
    < EXPECTED_LIFE_YRS / >
    < PRV_FY_NBV > 0 < / PRV_FY_NBV >
    < RATES_DEC > 40 < / RATES_DEC >
    < RATE_FROM_LAW > 50 < / RATE_FROM_LAW >
    < RATES_DEC1 / >
    < 1 > 0 < / 1 >
    < FISCAL_LIMIT > 750 < / FISCAL_LIMIT >
    < DEPRN_RATE > 20 < / DEPRN_RATE >
    < PY_DEPRN_RESERVE > 0 < / PY_DEPRN_RESERVE >
    < YTD_DEPRN > 316.95 < / YTD_DEPRN >
    < ACCUM_DEPRN > 166.95 < / ACCUM_DEPRN >
    < NET_BOOK_VALUE > 1333.05 < / NET_BOOK_VALUE >
    < YTD_IMPAIRMENT > 150 < / YTD_IMPAIRMENT >
    < IMPAIRMENT_RESERVE > 150 < / IMPAIRMENT_RESERVE >
    < ACCUM_LOST_RATES > 2.92 < / ACCUM_LOST_RATES >
    < DEPR_REINT_LOSS_NOTEXP > 0 < / DEPR_REINT_LOSS_NOTEXP >
    < GAIN_AMOUNT > 0 < / GAIN_AMOUNT >
    < GAIN_YEAR / >
    < > 110289 ASSET_ID < / ASSET_ID >
    < > 110289 ASSET_ID < / ASSET_ID >
    < REINT_NOT_ACC > 89,32 < / REINT_NOT_ACC >
    < PY_COL15 > 0 < / PY_COL15 >
    < LIST_G_COL15 >
    < G_COL15 >
    < COL15_TOT > 0 < / COL15_TOT >
    < COL16_TOT / >
    < COL_16 > 0 < / COL_16 >
    < / G_COL15 >
    < / LIST_G_COL15 >
    < / G_ASSET >
    < / G_FAMILY >
    < / LIST_G_FAMILY >
    < / SA321 >

    Now, I have a query like the following.

    Select *.
    FROM (SELECT sap_getFileContent ('o5875854.xml', 'DIR') report_data)
    T FROM dual)
    xmltable)
    "SA321/LIST_G_FAMILY/G_FAMILY/LIST_G_ASSET/G_ASSET.
    by the way of xmltype (t.report_data)
    path of VARCHAR2 (50) column column1 ' / SA321, LIST_G_FAMILY, G_FAMILY, PARENT_FAMILY.
    , path VARCHAR2 (100) Column2 "ASSET_DESCR."
    , Column3 VARCHAR2 (50) path 'EFFECTIVE_MONTH '.
    , NUMBER column4 path 'EFFECTIVE_YEAR '.
    , path NUMBER column 5 "ASSET_AMOUNT".
    , path NUMBER column6 "EXEMPT_GAIN_AMOUNT".
    , path NUMBER column7 'EXPECTED_LIFE_YRS '.
    , path NUMBER column8 'YTD_DEPRN '.
    , path NUMBER column9 "PY_DEPRN_RESERVE".
    , path NUMBER column10 'RATE_FROM_LAW '.
    , column11 NUMBER path '1 '.
    , path NUMBER column12 'FISCAL_LIMIT '.
    , path NUMBER column13 'YTD_IMPAIRMENT '.
    , path NUMBER column14 'ACCUM_LOST_RATES '.
    , path NUMBER column15 'YTD_IMPAIRMENT '.
    , path NUMBER column16 ' LIST_G_COL15/G_COL15/COL_16.
    ) x ;

    the query always returns NULL for collumn1. Can someone help me please.

    Concerning
    SAP

    Hello

    Your example of XML code is not correct, there is no LIST_G_ASSET element closing tag.
    But I guess that's not the real problem.

    the query always returns NULL for collumn1.

    The important thing to understand is that the paths that you declare in the COLUMNS clause are relative to the context item is past the main XQuery expression. He knows more about the rest of the document, in particular of his ancestors.
    In this case, you try to process a node whose absolute path would be

    /SA321/LIST_G_FAMILY/G_FAMILY/PARENT_FAMILY
    

    in a document which the node root is G_ASSET.

    The solution is to divide the query into two parts, the first one finds PARENT_FAMILY and the collection of G_ASSET and the second more shreds the collection G_ASSET is passed the first XMLTable in relational lines:

    SQL> SELECT x1.column1
      2       , x2.*
      3  FROM XMLTable(
      4         '/SA321/LIST_G_FAMILY/G_FAMILY'
      5         passing xmltype(bfilename('TEST_DIR','o5875854.xml'), nls_charset_id('AL32UTF8'))
      6         columns
      7           column1     VARCHAR2(50)  path 'PARENT_FAMILY'
      8         , assets      XMLType       path 'LIST_G_ASSET'
      9       ) x1
     10     , XMLTable(
     11         '/LIST_G_ASSET/G_ASSET'
     12         passing x1.assets
     13         columns
     14           column2 VARCHAR2(100) path 'ASSET_DESCR'
     15         , column3 VARCHAR2(50)  path 'EFFECTIVE_MONTH'
     16         , column4 NUMBER        path 'EFFECTIVE_YEAR'
     17         , column5 NUMBER        path 'ASSET_AMOUNT'
     18         , column6 NUMBER        path 'EXEMPT_GAIN_AMOUNT'
     19         , column7 NUMBER        path 'EXPECTED_LIFE_YRS'
     20         , column8 NUMBER        path 'YTD_DEPRN'
     21         , column9 NUMBER        path 'PY_DEPRN_RESERVE'
     22         , column10 NUMBER       path 'RATE_FROM_LAW'
     23         , column11 NUMBER       path 'CASE1'
     24         , column12 NUMBER       path 'FISCAL_LIMIT'
     25         , column13 NUMBER       path 'YTD_IMPAIRMENT'
     26         , column14 NUMBER       path 'ACCUM_LOST_RATES'
     27         , column15 NUMBER       path 'YTD_IMPAIRMENT'
     28         , column16 NUMBER       path 'LIST_G_COL15/G_COL15/COL_16'
     29       ) x2
     30  ;
    
    COLUMN1    COLUMN2                          COLUMN3        COLUMN4    COLUMN5    COLUMN6    COLUMN7    COLUMN8    COLUMN9   COLUMN10   COLUMN11   COLUMN12   COLUMN13   COLUMN14   COLUMN15   COLUMN16
    ---------- -------------------------------- ----------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
    2240       2240-Equipamento informatico     JANUARY           2009       3000        450                749,99          0         50          0       1275          0          0          0          0
    2240       2240-Equipamento informatico     JUNE              2009       1500          0                316,95          0         50          0        750        150       2,92        150          0
     
    
  • DAY MONTH FOR THE previous month

    Hello

    I invited where I have dates like below

    31/03/2012
    30/04/2012
    When I clcik 30/04/2012, I need previous months the other day, then the result should be 31

    When I give it as this TIMESTAMPADD (SQL_TSI_DAY,-30, DATE ' @{pvdate} "")... I get previous full day 31/03/2012
    When I give it as this DAYOFMONTH (DATE ' @{pvdate} "")... I get months current 30 day

    How to get the previous month of day?

    If you use guests then SQL result or in the SQL report to filter or fx on column

  • How to get unpaid balance 30 days from date selected

    Hi all

    I have to get the UPB (outstanding balance) of the table every day and I need to check the UPB of last month. There are daily and monthly tables separate. And according to the user enter the range of dates as the value of the setting that I need to get the monthly table.
    for example if the user enters the date range 01/08/2011 to 15/08/2011 while I check for the month of July monthly table to get the month previous UPB.

    Help, please

    Thank you

    Have you tried the add_months function?

    This would allow you to find the date of one month before the given value, then you can truncate to get the previous month. I have not tested, but I guess that the code would be something like as below:

    select trunc(add_months(to_date('15-08-2011','dd-mm-yyyy'),-1),'MON')
    from dual;
    
    01-JUL-11
    

    I don't know the layout of your tables, but I hope it helps.

    Kerri

    Published by: Kerri_Robberts on August 17, 2011 17:14

  • 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

  • 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

  • How to get sales last day of the previous month

    HELO guys

    I have a question how do I get sales date last day of the previous month where my fact table is level. in fact I tried using Ago but it seems not working. for example, if I chose December 29, 2014 so if I used the function there are then the result will display data on November 29, 2014 (not the last day of November 2014).

    Please guys if you have any solution and I really advise thanks to you.

    Not exactly under what circumstances specific as you try to reach this goal, but suppose you have a few guest dashboard where you select a day and you have a report with a measure where you want to show the sales of the last day of the previous month based on the selected date in the dash prompt.

    If you change the formula of this measure to something like:

    FILTER (with the HELP of 'Sales' (DATE = TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH(@{PV_DATE_SELECTED}) * (-1) + 1, @{PV_DATE_SELECTED}))))

  • How to get the last day of the weekend rather than a month

    Hi all

    Is the request appropriate and preferable to use to get the last business day of the month below?

    SELECT to_date('13.08.2014','dd.mm.yyyy') + MAX(RNUM) LastDay(nonweekend)
       FROM   (SELECT ROWNUM RNUM
              FROM   ALL_OBJECTS where rownum <=31)
      WHERE   ROWNUM <= 31 ANd
         TO_CHAR(to_date('13.08.2014','dd.mm.yyyy') + RNUM, 'DY','NLS_DATE_LANGUAGE=ENGLISH' ) NOT IN ('SAT' , 'SUN')
         and to_date('13.08.2014','dd.mm.yyyy') + RNUM <= last_day(to_date('13.08.2014','dd.mm.yyyy'))
    

    I have to use this motion for production.

    East - recommended to use?

    You can change your query this way:

    WITH t AS (SELECT trunc (to_date ('& calc_date', 'dd.mm.yyyy'), 'mm') + level - 1 calc_date)

    OF THE DOUBLE

    CONNECT BY LEVEL<= last_day(to_date('&calc_date',="" 'dd.mm.yyyy'))="" -="" trunc(to_date('&calc_date',="" 'dd.mm.yyyy'),="" 'mm')="" +="">

    )

    Select max (calc_date)

    t

    where to_char (calc_date, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') NOT IN ("SAT", "Sun");

  • How to get the last day of a month for every 2 months for a given period?

    Hello

    Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?

    Thanks in advance.

    Try the below

    SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.

    SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1

    WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    END as lastweekday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    -(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).

    END as lastweekendday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7

    END AS lastmonday

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

  • How to get the last day of the week?

    HII

    I can get the week number of calendar for a given date using

    SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual

    can any body tell me, how to get the last day of the week?

    and the answer should be: 04/08/2011(8th april)
    Thank you
    San

    Published by: sandeep9 on April 4, 2011 03:50

    Perhaps this...

    SQL> select trunc(sysdate,'WW')+6 from dual;
    
    TRUNC(SYSDATE,'WW')+
    --------------------
    08-APR-2011 00:00:00
    
    SQL>
    

Maybe you are looking for

  • bring skypekit!

    I'm working on Skype contacts with who I want to be able to talk outside the Skype interface terrible noisy spamy!

  • Windows Vista's sleep mode after 20 minutes while playing PC games even though my power settings are set to NEVER.

    Windows sleeps only during the performance of PC games (not all PC games, sometimes with Call of Duty 2 but not with FIFA 07). According to my settings sleep mode & disable the display are set to never for both blocked in battery mode. Any help would

  • Zoom on vista

    How can I disable zoom on Vista?  I have a mouse on my laptop and just use the touch pad.  The slightest movement activates the zoom function and my mouse turns into a magnifying glass and zoom in constantly in and out. I don't think it's a problem w

  • Please help... would like to have two monitors

    I use an hp TouchSmart 600 computer... I'm trying to get the video on my converter so I can hook up a monitor vga... but my computer does not recognize the second monitor... What am I doing wrong? my box say output vga and video in...

  • Reversal sensitive height button

    Hey, just started using the Muse and followed this tutorial - Adobe Muse Tips: Fading rollover on images | Droplets CreativeI followed that and have job bearings + text, the only problem is that when my pictures meet the width of the window that they