Date of the Monday of the week and year

Hi gurus,

I have the data for the week (eg.52) and year (eg. 08) and I need to get the date of the Monday of the week (December 21, 2008... IE 52nd week of 2008.)

Pls know me the solution for this sql statement...


Thank you
Shashi...

Hi, Shashi,

user588757 wrote:
Hi gurus,

I have the data for the week (eg.52) and year (eg. 08) and I need to get the date of the Monday of the week (December 21, 2008... IE 52nd week of 2008.)

Pls know me the solution for this sql statement...

Thank you
Shashi...

Surely you meant December 22, 2008, No 21.
Assuming that you are talking about ISO dates, where week 1 starts the Monday closest to January 1:

TRUNC ( TO_DATE ( :year_txt
                , 'YYYY'
                )
      , 'IY'
      ) + (7 * (:week_val - 1))

where: year_txt is a string and: week_val is a number.

TRUNC (dt, "IY") is attached to the Monday of the week 1.

Tags: Database

Similar Questions

  • Need to find the first Monday by concatenating the week and year

    Hello

    I'm looking for first Monday by concatenating columns week below and the year just ending as strings

    Test data: -.

    Week without year

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

    1                      85

    45                    95

    4                      05

    34                     68

    Please help me on this?

    SQL questions should go to the SQL space.

  • Today's date in the month and year

    Dear experts,

    I have a year and the number of the day, I wanted to identify the date
    ex: number of days = 203 year = 2009
    Date: 22/07/2009

    Please advice the best way possible to achieve.

    Thank you

    Dear user!

    Please try this code.

    SELECT TO_DATE(2032009, 'DDDYYYY') as dateval
    FROM   dual;
    
    DATEVAL
    -------------------
    22.07.2009 00:00:00
    

    This figure first three are the day number and the last four digits are the year. The DDD format will give you the day and the month as JJ.MM. YYYY format join the year your date. To do this, try:

    SELECT TO_DATE(2032008, 'DDDYYYY') as dateval
    FROM   dual;
    
    DATEVAL
    -------------------
    21.07.2008 00:00:00
    

    Yours sincerely

    Florian W.

    Published by: Florian W. the 22.07.2009 08:40

  • Date of the first and the last of the week

    I have a date that is


    dates week_no
    ---------------- -----------------
    1 JULY 09 ' 26


    I want to take the first and the last date of the week in which my date (1 July 09 ') exists, this means
    I want to catch the first date of the 26th week and the last date of the 26th week.

    Not sure what is your first day of the week, but in any case, you can change

    SQL> select dt, trunc(dt,'iw') monday, trunc(dt,'iw') + 6 sunday from (
      select date '2009-07-01' dt from dual
    )
    /
    DT         MONDAY     SUNDAY
    ---------- ---------- ----------
    01.07 2009 29.06 2009 05.07 2009
    
  • Perform calculations between the weeks and categories

    Given this example, if I calculate the difference between each week the intention and filing to show in the lines of the plan again and again filing?
    Row#     SEM     STUDENT_LEVEL     COLLEGE     PROGRAM     STATUS     Y3W2     Y3W3     Y3W4     Y3W5     Y3W6
    
    1     40     GR     BN     BMA-SJ     14.Intend     132     132     137     139     139
    2     40     GR     BN     BMA-SJ     17.Deposit     100     111     115     114     117
    3     40     GR     BN     BMA-SJ     20.New Intend     0     0     0     0     0
    4     40     GR     BN     BMA-SJ     21.New Deposit     0     0     0     0     0
    For example, the value displayed in Col: Y3W3 line #4 deposit must be the result of line Y3W3 2 - Row 2 Y3W2. Digitally: 111 minus 100 = 11.
    Tier 4 after that calculation should look like:
    4     40     GR     BN     BMA-SJ     21.New Deposit     1     11     4     0     3
    If the change is negative, then we would show 0.

    There are also some Calc percentage within the week and the categories and between weeks and years, but if understand us this, we can hope that use to others, so we won't post the part yet.

    Here's the query portion and sampling data. The sample data are summarized from the level of detail:
    WITH ADMLIST AS 
    (
    SELECT 1 AS WEEKNO, 2009 AS YEAR,          40 AS SEM, 
        'GR' AS STUDENT_LEVEL,  'BN' AS COLLEGE, 'BMA-SJ' AS PROGRAM, 
        '14.Intend' AS STATUS,  139  AS TOT
    FROM DUAL UNION ALL 
    SELECT 1 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit',    94 FROM DUAL UNION ALL 
    SELECT 1 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend',  0 FROM DUAL UNION ALL 
    SELECT 1 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL 
    SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend',    132 FROM DUAL UNION ALL 
    SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit',   100 FROM DUAL UNION ALL 
    SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend',  0 FROM DUAL UNION ALL 
    SELECT 2 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL 
    SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend',    132 FROM DUAL UNION ALL 
    SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit',   111 FROM DUAL UNION ALL 
    SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend',  0 FROM DUAL UNION ALL 
    SELECT 3 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL 
    SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend',    137 FROM DUAL UNION ALL 
    SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit',   115 FROM DUAL UNION ALL 
    SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend',  0 FROM DUAL UNION ALL 
    SELECT 4 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL 
    SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend',    139 FROM DUAL UNION ALL 
    SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit',   114 FROM DUAL UNION ALL 
    SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend',  0 FROM DUAL UNION ALL 
    SELECT 5 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL UNION ALL 
    SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '14.Intend',    139 FROM DUAL UNION ALL 
    SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '17.Deposit',   117 FROM DUAL UNION ALL 
    SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '20.New Intend',  0 FROM DUAL UNION ALL 
    SELECT 6 , 2009, 40, 'GR', 'BN', 'BMA-SJ', '21.New Deposit', 0 FROM DUAL 
    )
    SELECT sem,
           student_level,
           college,
           program,
           status,
    --       max(CASE WHEN WEEKNO=2 AND YEAR=2007 THEN TOT END) AS Y1W2,
    --       max(CASE WHEN WEEKNO=3 AND YEAR=2007 THEN TOT END) AS Y1W3,
    --       max(CASE WHEN WEEKNO=4 AND YEAR=2007 THEN TOT END) AS Y1W4,
    --       max(CASE WHEN WEEKNO=5 AND YEAR=2007 THEN TOT END) AS Y1W5,
    --       max(CASE WHEN WEEKNO=6 AND YEAR=2007 THEN TOT END) AS Y1W6,
    --       max(CASE WHEN WEEKNO=2 AND YEAR=2008 THEN TOT END) AS Y2W2,
    --       max(CASE WHEN WEEKNO=3 AND YEAR=2008 THEN TOT END) AS Y2W3,
    --       max(CASE WHEN WEEKNO=4 AND YEAR=2008 THEN TOT END) AS Y2W4,
    --       max(CASE WHEN WEEKNO=5 AND YEAR=2008 THEN TOT END) AS Y2W5,
    --       max(CASE WHEN WEEKNO=6 AND YEAR=2008 THEN TOT END) AS Y2W6,
           max(CASE WHEN WEEKNO=2 AND YEAR=2009 THEN TOT END) AS Y3W2,
           max(CASE WHEN WEEKNO=3 AND YEAR=2009 THEN TOT END) AS Y3W3,
           max(CASE WHEN WEEKNO=4 AND YEAR=2009 THEN TOT END) AS Y3W4,
           max(CASE WHEN WEEKNO=5 AND YEAR=2009 THEN TOT END) AS Y3W5,
           max(CASE WHEN WEEKNO=6 AND YEAR=2009 THEN TOT END) AS Y3W6
    FROM ADMLIST
    GROUP BY sem,
             student_level,
             college,
             program,
             status
    ORDER BY 5;

    Hello

    You can get the difference from one week to the next (or 0) using the analytical LAG function, like this:

    GREATEST ( tot - LAG (tot) OVER ( PARTITION BY  status  -- and maybe other columns, like sem, student_level, ..., too
                                           ORDER BY      year
                          ,          weekno
                        )
           , 0
           )     AS dif
    

    Corresponds to the data you posted really what is in your tables, or is it the result of an earlier stage?

    If it's really in your tables, and then instead of select of your tables, select in a UNION of
    (a) your table except the lines where status = '21.New' file
    (b) your table, once again, with status ='21.New deposit "and the numbers of dif (as shown above) in the column tot.

    If the data you posted is a partially digested form of your RAW files, then dif can probably be incorporated into the digestion process.

    In any case, calculate dif until you rotate the data.

  • How to get back my data for the health and the watch Apps once I've restored my phone?

    How to get back my data for the health and the watch Apps once I've restored my phone?

    From the backup, you're going to be restoration.

    If you back up to iTunes, make sure that it is an encrypted backup.

  • I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows?

    I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows so that I can do the calculations?

    If you start the https://forums.adobe.com/welcome Forums Index

    You will be able to select a forum for the specific Adobe products you use

    Click on the symbol "arrow down" on the right (where it is said to see all our products and Services) to open the drop-down list and scroll

  • get the month and year of date type

    Hi all
    I need to get the month and year of type date.

    For example
    select to_date('2011-01-17', 'yyyy-mm-dd') from dual;
    Required result:
    01-2011
    Any ideas?

    Thanks in advance,
    Bahchevanov.
    select to_char(to_date('2011-01-17', 'yyyy-mm-dd'),'mm-yyyy') from dual;
    

    HTH

  • How do you have a field data on the other and stay readonly?

    I am trying to create two identical forms on the same page.  The first is for the entry, and the second is a copy of the employee.  I would like to set the fields on the second form to receive the data from the first and also set the form fields second as readonly.

    It is possible. The problem is of option buttons and check boxes do not have a validate event (which is exposed) as other types of fields, it should take a different approach with them. One way is to use the mouse event to the top and the code like this:

    getField("checkbox2").value = event.target.value;

    You must do this for each button to check/radio.

  • the start date of the week formula

    Hi guys,.

    I have a report in which I need to display the Start Date of the week for a particular calendar date, for example

    Date week Start Date
    ---------- ---------------------------
    July 01, 2010 June 28, 2010
    July 2010 05 05 July, 2010
    11 July, 2010 05 July, 2010

    No idea how can achieve us.

    Thank you
    Ronnie

    TIMESTAMPADD (SQL_TSI_DAY, 2, TIMESTAMPADD (SQL_TSI_DAY, DAYOFWEEK (CURRENT_DATE) *-1, CURRENT_DATE))

  • ODI can load data into the planning and REPLACE the existing data?

    Hello
    ODI (9.3.1.1) can load data into the planning and REPLACE the existing data?
    Currently of our ODI by "ADD" load to existing data data - so that is I accidentally run the load twice, it would be double planning numbers. I don't know how to do it to REPLACE so that running more than twice has no effect.

    With the help of the essbase adapter you would use a rule of load, in the State of charge, you can set whether to replace or add to existing values. It is not difficult to pass.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Date formats incompatible of apex between weekly and daily calendar

    I use the Apex ajax calendar to view activity.  My user has noticed that the date format changes between the weekly and daily life, that is to say the 07/08 (MM/JJ) and 08/07 (JJ/MM) respectively.  Is this a bug or is at - there somewhere some control of date format?

    I use the following to call pages

    Weekly

    JavaScript:apex.widget.Calendar.ajax_calendar ('W', 'same'); void (0);

    Every day

    JavaScript:apex.widget.Calendar.ajax_calendar (', 'same'); void (0);

    Thank you

    Drew

    Request Express 4.2.3.00.08

    Hello

    You can check your calendar template (shared components-> models-> calendar or go to the page that contains the schedule-> tree of shared components-> choose the calendar), if it uses the same date format for weekly view masks and every day? You will see variables substitution as #MM #, #DD # and so on.

    Concerning

    Patrick

    Member of the APEX development team

    My Blog: http://www.inside-oracle-apex.com

    APEX Plug-Ins: http://apex.oracle.com/plugins

    Twitter: http://www.twitter.com/patrickwolf

  • selection of the week, month, year in source throgh odi 11g?

    Hello

    I have 3 years of data in a source table (tableatm). data will be added to this table eod.

    img2.jpg

    I applied the filter on the column atm_date below screenshot

    Based on the filter, I want to load the data of the year underway, data of the current month data of the week underway, data from the previous month, data from the previous week, data from the previous year to this table.

    If I want to load data for 2010, then filter applied on TO_CHAR (TABLEATM. ATM_DATE, 'YYYY') = '2010' , I get only the data of 2010.

    If want to download data from 2015, filter applied on TO_CHAR (TABLEATM. ATM_DATE, 'YYYY') = "2015". But it's constant...

    I want to give the filter like that.

    TO_CHAR (TABLEATM. (ATM_DATE, «YYYY») = double '(sélectionnez (sysdate,-12)) ". When I applied the filter using this formula on this date column. I don't get all the data.

    Please help me...

    img1.jpg

    Please help me,

    Thanks in advance,

    A.Kavya.

    Hello

    I applied the dynamic filter as shown below. now, I get only the data of the year 2015...

    filter condition is

    TO_CHAR (to_number (to_char (TABLEATM. ATM_DATE, "YYYY"))) = (SELECT to_char (to_number (to_char (SYSDATE, 'YYYY'))-1)

    THE DOUBLE)

    Thanks & regards,

    A.Kavya.

  • Get the number of days in a month based on the month and year of fields

    I have a column in my form which lists the days in a month. I want to configure a hidden field that calculates the total number of days in a month, based on the month and year of the field inputs. The number of days will determine what appears on the column. For example, if I put 4 months, and 2016 in the field of the year, I get 30 in the hidden field. Thus, on the column 'Day', I'll have numbers 1-30. Or if I put 2 months and 2016 in the field of the year, I get the 29 in the hidden field. If the numbers 1-29 appears in the column 'day '.

    Found this on some forum javascript code:

    //Month is 1 based
    function daysInMonth(month,year) {
      
    return new Date(year, month, 0).getDate();
    }

    //July
    daysInMonth
    (7,2009); //31
    //February
    daysInMonth
    (2,2009); //28
    daysInMonth
    (2,2008); //29

    I do not know how to convert this code in JavaScript to adobe and don't really know how to use it. All I know how to do is to configure the field values for the field month and year as variables. I am a novice programmer and would appreciate it really all the help I can get. Thank you in advance!

    The code seems to be JavaScript and runs as needed by using the JavaScript console.

    I would like to consider making more general code, so if you have a date string that includes at least the month and year we could just call the function and get the number of days for that month.

    The following script will calculate the number of days in a month, by using at least the month and year values can display the result on the JavaScript console and all of the value field for the field that has this code as the custom calculation Script.

    function daysInMonth (oDate) {}
    return new Date (oDate.getFullYear (), oDate.getMonth () + 1, 0) .getDate ();
    }

    nMonth var = this.getField("Month").valueAsString; get the value of month;
    nYear var = this.getField("Year").valueAsString; get the value of the year;

    Event.Value = "";

    If (nMonth! = "" & nYear!) = "") {}
    var MyDate = util.scand ("' / mm/yyyy ', nMonth +" / "+ nYear); convert to date object;
    var nDaysInMonth = daysInMonth (MyDate); get the number of days;

    Console.Open (); Open the JavaScript console;

    Console.clear(); clear the console;

    Console.println ("Days in" + nMonth + ":" + nDaysInMonth); show days in month;

    Event.Value = nDaysInMonth; Set the value of the field;

    }

  • Schedule of blackBerry Smartphones, day of the week and no weekends

    I need to make a call every day at the same time, Monday to Friday. How can I configure the calendar for Monday by induction Friday and not the weekend?

    Thank you

    Go to your calendar, select the day you want to start everything for example today, Agu.4 Monday 2008. Select your time as a normal date, set your details as usual, now under Select weekly recurrence, you will see a planner 7 days pop up. S M T W T F S.  "BOLD" of the Agenda 7 letters are selected days. Choose the days you want to be, below that you will see the END of installation: choose never, this will make continue nonestop unless do you stop by going in your calendar and removing.

    Hope this helps

Maybe you are looking for

  • iPhone 3 iOS 4.1 - is there any app available yet for this phone text message

    I would like to use my old iPhone 3 iOS 4.1 for an emergency situation. Is there any text message apps that still work?

  • NI 9474 digital output errors

    Hello I'm playing with NI 9474 to learn how the outputs digital work with labview. However, I can't even the basic element down. I have a 9v battery connected to the unit and an element of resistance hung on one of the terminals of the device output.

  • Vista Patch... Third time is a charm no start after update

    I am running Vista Home Premium x 64 on a Gigabyte card with 4 GB of RAM. The last update applied to stop the system while I was with her and now the cycles over and over. When you try to start using "safe" mode initialization freezes on crcdisk.sys

  • Acer aspire 571 with intel graphics chip e1, dysfunction

    I bought this laptop on a roadtrip from 3 days ago. Its kinda go further, back to return. The problem started the second day of use. It most often occurs during playback of videos with windows media player, but sometimes when a game or just surf the

  • Levels of raid Volumes Compellent

    Hello. We are looking into buying a Bay Compellent, Dell, but before I look for in its technology. Unfortunately, the few public records on the SC8000 are very brief. I'm looking for information how the table handles its raids, from what ive understo