First day of year and next monday of the year

Dear all;
Given a year, how do you determine the very first day of that year and the next two mondays for that year...

Hi,
user13328581 wrote:
Dear all;
Given a year, how do you determine the very first day of that year and the next two mondays for that year...As Sayan hinted, you can use NEXT_DAY to find the next Monday after (not the same as) a given date.
NEXT_DAY(trunc(SYSDATE), 'MON') next_mondayis the next Monday after today. (You may not need TRUNC in the example above.)
For the Monday after January 1 of this year:
NEXT_DAY ( TRUNC (SYSDATE, 'YEAR')
         , 'Monday'
         )If the year happens to begin on a Monday, this will return Jaunary 8, the 2nd Monday of the year; otherwise, it will be the 1st Monday of the year.
For the 2nd Monday after New Year's Day, add 7 to the expression above.

Similar Messages

  • Need sql querry for  PreviousYear First Day Same Month And Currentday rec

    Hi ,
    I hAVE TABLE FOR EXAMPLE,
    emp sal Arrivaldate
    111 200 03-mar-2011
    100 200 03-mar-2008
    150 200 06-mar-2012
    170 200 03-mar-2003
    178 200 03-mar-2004
    112 200 12-jun-2012-------------------->For Example THIS IS TABLE WE HAVE LOT OF RECORDS
    I need querry to get based on this condition:Arrival Date is between Previous Year First Day Same Month And Current day.
    Any one help me on this.....

    Hi,
    To get the records between Previous Year First Day Same month to Current day..
    SELECT TRUNC (ADD_MONTHS (SYSDATE, -12), 'MM') AS last_yr_first_date, TRUNC(SYSDATE) AS PRESENT_DATE
      FROM DUAL;Which Outputs to:
    LAST_YR_FIRST_DATE     PRESENT_DATE
    6/1/2011                   6/13/2012When you give TRUNC(sysdate) It will removes the Time part of the SYSDATE.
    For Ex :
    TRUNC(SYSDATE) means that is 6/13/2012 which doesn't give the time part in the query.
    Which takes into account the day start that is from 12:00 A.M to today midnight 11.59 P.M.
    And, One thing is that
    emp sal Arrivaldate
    111 200 03-mar-2011
    100 200 03-mar-2008
    150 200 06-mar-2012
    170 200 03-mar-2003
    178 200 03-mar-2004
    112 200 12-jun-2012The arrivaldate is in Character format so you need to convert to date type as
    SELECT TO_DATE(ARRIVALDATE,'DD-MON-YYYY') from your_table;
    and the comparison can be done as
    SELECT *
      FROM YOUR_TABLE
    WHERE TO_DATE (ARRIVALDATE, 'DD-MON-YYYY')
       AND TRUNC (ADD_MONTHS (SYSDATE, -12), 'MM')
       AND TRUNC (SYSDATE);Good day!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks,
    Shankar

  • First day on iCloud and not a fan!

    First day on iCloud and not a fan! ... Why isn't it working. I don't mind changes only when they are improovements, but make sure it works before you make us all switch over.

    I don't have a problem here, but if you look at the latest posts here there seem quite a few who are, perhaps it's location specific, you might want to add your location to your profile and take a look at some of the other threads on this topic.

  • HT201441 I restored my phone and now it is asking me to activate it and i am trying but it is saying i cant activate my phone with my own id that i have to use the id that i used to set up my iphone the very first day i got it but that is the id. help ple

    I restored my phone and now it is asking me to activate it and i am trying but it is saying i cant activate my phone with my own id that i have to use the id that i used to set up my iphone the very first day i got it but that is the id. help please

    You can try calling Apple support at 0800-761-0880 and explaining the situation to them. Perhaps there will be something they can do to help. Try asking to speak with a Customer Relations representative, though I don't know if they have them in Brazil.
    Regards.

  • HT1325 Just brought the MacPro and first time using iTune and Yes I authorized the computer. But for a few purchased songs, only 30 seconds of the song plays and for one song off an album, a pop comes up saying I need to authorized the computer, but it is

    Just brought the MacPro and first time using iTune and Yes I authorized the computer. But for a few purchased songs, only 30 seconds of the song plays and for one song off an album, a pop comes up saying I need to authorized the computer, but I do this and it says it is authorized already. I click on the song to play it and this process repeat (saying it is not authorized, then saying it is already authorized)

    If your country's iTunes Store allows you to redownload purchased tracks, I'd delete your current copies of the dodgy tracks and try redownloading fresh copies. For instructions, see the following document:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    Otherwise, I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the items that are not playing properly. If you can't see "Report a Problem" next to the items, click the "Report a problem" button. Now click the "Report a Problem" links next to the items.

  • First Day of Year based on given 12-month date

    Hi All,
    i want to get first day of the given year based on 12-month financial year.
    i'e if i entered '21-Sep-2014' as a given date then expected output is '01-Oct-2013'
    Could you please suggest best way to get this done.
    Thanks in advance.
    bala krishna

    Dan thanks for your reply.
    am adding more description below to my post:
    The thing is for a given date i needs to find out
    Year Start Date , Year
    End Date.
    For this am using below scripts respectively
    SELECT DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0);
    SELECT DATEADD(DD, -1 ,DATEADD(yy, DATEDIFF(yy, 0, GETDATE()) + 1, 0));
    Here , the problem is , now its giving the current year first day and Last day.
    But what i want is Year first day should be based on (minus 12 month) i'e '01-OCT-2013'
    and Year End Day should be '30-SEP-2014'
    i hope now the requirement is more clear.
    bala krishna
    Try like this
    SELECT DATEADD(mm,DATEDIFF(mm,0,GETDATE())-11,0) AS StartDate,DATEADD(mm,DATEDIFF(mm,0,GETDATE())+1,-1) AS EndDate
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Function TODATE. Distinct first day of year

    In our Information System we have several companies and each of them has a different starting date of the fiscal year.
    For example, some start the year’s exercise on January 1st and others start on April 1st
    We want that the accumulated work commence on the basis of the beginning of the Fiscal Year, in some companies from January 1st and others from April 1st.
    All the companies are in the same information system.
    Is it possible to do this using the function TODATE?

    Hi Kelvin,
    There's an in-built SQL function to do this.
    Function Name: TRUNC
    SQL> SELECT TRUNC(TO_DATE('17-DEC-2001'),'YEAR') "First Day" FROM Dual;
    First Day
    01-JAN-01
    SQL> SELECT TRUNC(SysDate,'YEAR') "First Day" FROM Dual;
    First Day
    01-JAN-02
    For more info
    http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a90125/functions152.htm#79763
    Regards
    Elango.

  • My First Days in Life and work events

    Hi All,
    I want to implement the My First Days alone in the Life and work events for other countries. I found some notes and docs saying how to adopt the entire LWE for other countries. But i need My first days alone. Is it possible to do so?
    Regards,
    Vijay

    In continuation of my question...
    In order to use Life and Work Events application (For Non US)..
    I updated the process template id in resource definition in SPRO transaction.
    Earlier it was :
    URL Parameter : process.template.id=CECE64A19C8F11DAA5C1000E7FA67AEB&process.autostart=true (for US)
    now I have changed it to
    URL Parameter : process.template.id=CE140F51C11711D9824C000BCD45EE55&process.autostart=true (for non US)
    So now I guess I am actually picking up non US application..
    But now when I try to access application :
    Personal Data in My first days
    Family/member dependent
    I am getting below error :
    The following ABAP Exception occurred: SERVICEKEY_INVALID:
    caused by
    Caused by: com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFC_Fault_Exception: Fault name: SERVICEKEY_INVALID, fault text: SERVICEKEY_INVALID
    I do not even know whether i should revert back to old process template id for US country

  • RSD the first day i got my macbook, am i the unluckiest or what...?

    first, my order was delayed for THREE WEEKS!! then the day i got my computer, RSD occurred. all sorts of random shut down too, the shut down without any message, the message of multiple languages to restart, and the fact that i can't even turn it on for a long period of time after RSD occurs.
    it seems that RSD happens to people after some time, but mine happened the first day i got my computer...

    I'm sorry to hear that your macbook RSD the first time you got it. That *****! Did you get the Black Macbook or the White? I just got my Black Macbook from Ebay and I only paid $1,100 for it and it had 2ghrz processor and 2 gig RAM. The person I bought it from, got it in the middle of June so it still have 9 months of warranty. It works great no RSD, I hope I never get it 'cause I am using it right now and it works great! I am loving it! The first day I got it, I used it all night until the morning and did the yes test to see if it will RSD. It never RSD so I hope it will stay this way at least up to when I am ready to buy the new model of macbook. Hopefully in two years.

  • How can I get the date of the next monday from the currentday?

    How can  I get the date of the next monday from current day? Please advice.
    mayooran99

    Hi mayooran,
    Please try the following code
    DateTime nextMonday = DateTime.Today.AddDays(((int)DateTime.Today.DayOfWeek - (int)DayOfWeek.Monday) + 7);
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Sum of first 50% of rows and remaining 50% of the rows seperately

    Hi
    I have a table
    create table eresults
    (student_name varchar2(20),
    section_name varchar2(4),
    exam_id NUMBER (4))
    marks NUMBER (3))
    Begin
    insert into eresults values ('MOEED', 'A', 1, 20);
    insert into eresults values ('SARAH', 'A', 1, 30);
    insert into eresults values ('SAM', 'A', 1, 24);
    insert into eresults values ('MOEED', 'A', 2, 65);
    insert into eresults values ('SARAH', 'A', 2, 100);
    insert into eresults values ('SAM', 'A', 2, 4);
    insert into eresults values ('MOEED', 'A', 3, 34);
    insert into eresults values ('SARAH', 'A', 3, 10);
    insert into eresults values ('SAM', 'A', 3, 40);
    insert into eresults values ('SARAH', 'A', 4, 33);
    insert into eresults values ('SAM', 'A', 4, 99);
    end;
    / I want to take a sum of marks, group by student name, for each student in such a way that their first 50% of exams (order by exam id) marks sum is shown seperately in a column and the remaining 50% of the exams summed marks are shown in another column. For students appearing in odd number of exams, like 1,3,5,7 etc - I want the calculation in such a way that first 50% sum will show marks obtained like this: For example a student appeared in 3 exams, so 50% exams shall be 1.5 exams - so the sum of first 50% should be his first exam marks + the 50% of the marks obtained by him in the 2nd or middle or tie breaker exam. And the remaining 50% exam marsk shall be: the 50% of the marks obtain in the 2nd exam + the marks obtained in the 3rd exam. Based on above data, Moeed appeared in 3 exams, and his marks were 20, 65 and 34. So his first 50% marks shall be 20 + 65/2 = 32.5 => 52.5 total marks. And his 2nd 50% marks shall be 65/2 = 32.5 + 34 = 66.5 total marks
    I hope I've been able to clear my requiment.
    I will appreciate the shortest and simplest possible query to achieve since I've a large data and then I also need to take average of first 50% sum marks divided by 50% of the exams.
    Thanks in advance.
    regards
    Hamza
    Edited by: Hamza on May 25, 2011 12:46 AM

    TRy this
    /* Formatted on 2011/05/24 16:23 (Formatter Plus v4.8.8) */
    SELECT student_name, section_name, marks,
           SUM (marks) OVER (PARTITION BY student_name, section_name) sum_marks,
           CASE
              WHEN exam_id = 1
                 THEN   marks
                      +   LEAD (marks, 1, 0) OVER (PARTITION BY student_name, section_name ORDER BY exam_id)
                        / 2
              WHEN exam_id = max_id_exam
                 THEN   marks
                      +   LAG (marks, 1, 0) OVER (PARTITION BY student_name, section_name ORDER BY exam_id)
                        / 2
              ELSE marks
           END res
      FROM (SELECT student_name, section_name, exam_id, marks,
                   MAX (exam_id) OVER (PARTITION BY student_name, section_name)
                                                                      max_id_exam
              FROM eresults)
    STUDENT_NAME         SECT      MARKS  SUM_MARKS        RES
    MOEED                A            20        119       52.5
    MOEED                A            65        119         65
    MOEED                A            34        119       66.5
    SAM                  A            24        167         26
    SAM                  A             4        167          4
    SAM                  A            40        167         40
    SAM                  A            99        167        119
    SARAH                A            30        173         80
    SARAH                A           100        173        100
    SARAH                A            10        173         10
    SARAH                A            33        173         38
    11 rows selected.Edited by: Salim Chelabi on 2011-05-24 13:23

  • Variable with low value as first day of year and high as  key date

    hi all,
                i need to create a variable with key date for which the low value should be 1st day of the year,
    means if i enter a key date (5/9/06) the values to  appear should be from 1/1/06 to  5/9/06.
    If i want the manipulation based on key date like key date + 90 etc. is it possible?
    i have written a customer exit as
    case i_vnam.
    when 'keydate'
    clear : e_t_range,
           l_t_range.
    DATA DAT(8)TYPE D.
    LOOP AT i_t_var_range INTO loc_t_var_range.
            IF loc_t_var_range-vnam = 'keydate'.
              loc_found = 'X'.
              EXIT.
            ENDIF.
          ENDLOOP.
    DAT = loc_t_var_range-vnam .
    if loc_found = 'X'.
       l_s_range-sign = 'I'.
            l_s_range-opt = 'BT'.
            CONCATENATE sy-datum(4) '01' '01' INTO l_s_range-low.
            l_s_range-high = DAT.
            APPEND l_s_range TO e_t_range.
          ENDIF.
    WILL THIS CODE WORK.
    I FEEL THERE IS PROBLEM WITH L_T_RANGE- HIGH.
    IS THERE A DICREPENCY IN THE CODE?
    IS THE CALLING SEQUENCE OF THE VARIABLE CORRECT?
    PLZ LET ME KNOW.
    THANK U ALL

    Hi,
    my mail bounced back. send vaild mail id.
    try this.
    1) create one customer exit variable say zcuvar
    2) create a USER entry variable Keydate 0date.
    3) in CMOD, in I_STEP  = 1 of zcuvar, make it default value ad 01/01/2006 as you have done.
    4) in use as range in Selection restrict.
    zcuvar;0date.
    hope i m clear.
    regards,
    San!

  • First day with java: and first problem

    Hi friends,
    may be i'm hurrying a bit. But i really don't have time. I'm a PHP programmer , trying to shift to java, and i have one week to learn core java, j2ee and blah blah! And here i'm with a confusion.
    When i tried implementing servlet , i didn't get any output:
    public void init(ServletConfig config) throws ServletException {
    System.out.println("init");
    but when i tried extending httpServlet , that worked.
    whats the problem?
    and will be happy to get a few tips.
    Thanks.

    Your best bet would be to get someone with years of java experience at your side and have him set up your environment and will stand by when you get stuck. There is a LOT to learn that will take far far longer than one week to learn (more like years to get any good). Its a totally unrealistic expectation.
    Here's a rundown for a quick start:
    * Download and install JDK
    * Download and install Eclipse Ganymede IDE
    * Download and install Tomcat
    * Download and install Tomcat plugin for Eclipse
    * Build a hello world JSP page and run it in tomcat
    * Build a hello world Servlet and run it in tomcat
    * Install a free database such as Oracle Lite or MySql.
    * learn how to use the database's free utility to create database tables and grant permission to read/write to them.
    * Learn JDBC and get your program to connect to the database and query it.
    * Learn MVC design

  • Powershell Change date to the first day of last month whenever i run the script.

    If I run the script on 2/4/2013 or any other day in February I want the date to be change to 1/1/2013. I am replacing date on line 59 with this value.
    Get the content of the CMS Script.
    $CMSReport = Get-content C:\reports\CMSReport.acsauto
    Go to line 59 and replace the date for Last Month date.
    $CMSReport[58] = $CMSReport[58] -replace "([1-9]|0[1-9]|1[012])- /.- /.\d\d", [datetime]::Today.ToShortDateString() $CMSReport | Set-Content C:\reports\testCMS.acsauto
    Run the CMS script
    Invoke-Expression -command "c:\reports\testCMS.acsauto"

    PS C:\> $lastMonth = (get-date).AddMonths(-1)
    PS C:\> $firstDayOfLastMonth = get-date -year $lastMonth.Year -month $lastMonth.Month -day 1
    PS C:\> "{0:yyyy-MM-dd}" -f $firstDayOfLastMonth
    2013-01-01
    Bill
    Hello AbqBill,
    Thanks for getting me there. I am a lot closer to the final goal. I input what you suggested and I am getting different results as you. here what I did.
    $LastMonth = (Get-Date).AddMonths(-1)
    $FirstDayofLastMonth = Get-Date -year $LastMonth.year -month $LastMonth.month -day 1
    $CMSReport = Get-content C:\reports\CMSReport.acsauto
    $CMSReport[58] = $CMSReport[58] -replace "([1-9]|0[1-9]|1[012])[- /.]([1-9]|0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d", "{0:dd/MM/yyyy}" -f $FirstofLastMonth
    $CMSReport | Set-Content C:\reports\testCMS.acsauto
    I get 12/1/2013. Which bring me to 2 questions. How will this solve when it is January and it has to put last month last year? and why is it going back two month instead of 1?

  • How do i get my back camera to work? After my first update it crashed and after coming back the back camera wasnt wrking

    My entire camera app doesnt work when i try opening it my camera crashed after the first installation. The only place i can take pics is in my photo booth and only front pics from d feont camera

    If you just bought it, you could return it.
    Or you could get a microUSB cable and restore the device from iTunes on your computer.

Maybe you are looking for

  • My second BT ordeal in six months - second attempt

    Oops.. I think I may have only posted the title of this message first time around. Earlier this year, I made what I thought was a simple request to BT to upgrade my broadband from Option 1 to Option 3. This they did, but at the same time they cancell

  • Error in executing process from the UWL task list

    Hi, I have created a process and assigned different users to different steps. For administrator, Overseer and Owner, i have kept role as initiator only. For the actions of the process, set the value as Initiation defined and in Default Roles tab, hav

  • HT1766 Trying to restore from back up and it is asking for password.

    I do not remember setting up a password for backing up and none of my passwords will work.  How do I reset my password?  I doesn't give me an option.

  • TS3276 How to remove duplicate emails in Apple Mail program

    How do I remove duplicate emails from Apple Mail.   I have runt he "remove duplicates" scripte several times and it finds nothing.  I see clearly that I am  receiving   many duplictes.

  • Excel File Management Apache POI HSSF vs. jxl jar

    I've been reviewing Java technologies for managing Excel files, and I'm a little confused about the differences between Apache's POI HSSF implementation and JExcelApi, and utimately what technology it makes sense to use. They are both open source, al