How to get the last day of the year

Hi all

Thanks in advance...

How do I get the last day of the year that I'm passing date at run time.

I can manage to get the first day of the year by
SELECT TRUNC(SYSDATE,'YEAR') AS FDAY_YEAR
of the double

Thanks in advance

Concerning
Sachin
  1*  select ADD_MONTHS(trunc(sysdate,'yyyy'),12)-1 dd from dual
SQL> /

DD
-----------
31-DEC-2010

Tags: Database

Similar Questions

  • 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 year of Date data

    Hi all

    I have the following scenario:

    County - Date - Code
    5 DS - 01/09/2009
    5 DS - 15/01/2009
    5 LO - 21/01/2009
    1. IT - 02/09/2009
    5 DS - 03/09/2009
    5 LO - 04/09/2009
    4 DS - 05/09/2009
    5 - IS - 06/09/2009
    5 DS - 07/09/2009
    5 - IS - 08/09/2009
    3 DS - 09/09/2009
    5 DS - 10/09/2009
    5 LO - 11/09/2009
    2 DS - 12/09/2009
    5 DS - 01/09/2010
    5 LO - 02/09/2010
    4 DS - 03/09/2010

    How can I only CDA data for 2009 and one year for 2010... Is meant by CDA 2009 data until the day of the date for example, if its 9 March today... TBE outcome will bring full jan, Feb and until the 9th day of March ' 09 and full jan, Feb and until the 9th day of March 10

    Thank you

    Published by: [email protected] on March 9, 2010 23:03

    Published by: [email protected] on March 9, 2010 23:06

    Something like:

    where dt <= trunc(dt,'YYYY')+(trunc(sysdate,'DD')-(trunc(sysdate,'YYYY'))
    

    "Dt" corresponding to your date column.

  • How to get the year and month of a whole year

    Hello

    I have a list of selection and when the user selects the list values are like this 201101,201102,201103

    I tried like this


    declare
    T_DATE varchar2 (25);
    Start
    because me in 1.12 loop
    Select TO_CHAR (ADD_MONTHS (SYSDATE, + 1), "YYYYMM") in the double T_DATE;
    dbms_output.put_line (V_DATE);
    end loop;
    end;

    But its bad and I can not get clear idea where to change the code

    Thanks and greetings
    Srikkanth.M

    Srikkanth.M wrote:
    Hello

    I have a list of selection and when the user selects the list values are like this 201101,201102,201103

    If you want to list for the current year from Jan 201101,201102, 201103... 201112, then try this

    DECLARE
      v_Date  VARCHAR2(25);
      n_month NUMBER;
    BEGIN
      SELECT extract (MONTH FROM sysdate) INTO n_month FROM dual;
      FOR i IN 1..12
      LOOP
        SELECT TO_CHAR(ADD_MONTHS(SYSDATE, (i-n_month)), 'YYYYMM')
        INTO v_date
        FROM dual;
        dbms_output.put_line(v_date);
      END LOOP;
    END;
    

    Vivek L

  • 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 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>
    
  • How to get the maximum number of days in a month?

    How to get the maximum number of days in a month?

    I use a dateField. where I can get the month. Now, I want to get the maximum number of days in a month.

    How can I get it?

    Please help me. and thanks in advance... []

    NET. RIM. Device.API.util
    Class DateTimeUtilities

    getNumberOfDaysInMonth (int month, int year)
    Returns the number of days in the specified month

    It took me like 10 seconds to find it in the API, I guess you spent more time writing the post...

  • How to get the last access to the workflow? (OM, WMS) release 11.5.9

    Hello my friends.

    I am looking for information on how to get the date of the access and the user name who did use some WFs in OM and last WMS.

    If it is through the application or running in the background via SQL for the information is not important to me.

    Could you help me with this?.

    Thank you

    the 'item_type' attribute must match the name of the WF?

    Yes (internal name. For example OEOL).

    The custom of those who will not be affected by the upgrade.

    You must run the query that I provided before to identify if the workflow is used or not.

    For the workflow of order lines, it is intended to be used as you use the order management.

    Kind regards

    Bashar

  • How to get the 'DAY' based on the territory of current account held a number between

    Hi all

    Looks like I'm at the end of my intelligence here but how to get the 'DAY' based on the territory of current account with a number between 1 and 7? Oracle has functions to extract the day of the week, but I can't find the other way around.
    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    
    SQL> alter session set nls_territory=AMERICA;
    
    Session altered.
    
    SQL> select to_char (sysdate, 'D') from dual;
    
    T
    -
    3
    
    SQL> alter session set nls_territory=GERMANY;
    
    Session altered.
    
    SQL> select to_char (sysdate, 'D') from dual;
    
    T
    -
    2
    I need a way to know that the number '3' on the database with NLS_TERRITORY = AMERICA means a 'Tuesday' or the number '2' on a database with NLS_TERRITORY = GERMANY means "Tuesday" as well.

    Hope I am clear enough.

    And wish you all a happy new year :)

    Kind regards
    Smail

    Use the format "IW" to get the date of Monday and the format "DAY" to get the "first day of the week. Then compare dates to see if they are identical.

    ALTER SESSION SET NLS_TERRITORY = 'AMERICA';
    
    SELECT TRUNC(SYSDATE-LEVEL, 'IW') "Monday",
    TRUNC(SYSDATE-LEVEL, 'DAY') "NLS First day of week",
    MOD(TRUNC(SYSDATE-LEVEL, 'IW') - TRUNC(SYSDATE-LEVEL, 'DAY') + 7, 7) "1 if day 1 = SUN, 0 if MON"
    FROM DUAL CONNECT BY LEVEL <= 7;
    
    Monday    NLS First day of week 1 if day 1 = SUN, 0 if MON
    --------- --------------------- --------------------------
    31-DEC-12 30-DEC-12                                      1
    24-DEC-12 30-DEC-12                                      1
    24-DEC-12 23-DEC-12                                      1
    24-DEC-12 23-DEC-12                                      1
    24-DEC-12 23-DEC-12                                      1
    24-DEC-12 23-DEC-12                                      1
    24-DEC-12 23-DEC-12                                      1
    
    alter session set nls_territory = 'FRANCE';
    
    SELECT TRUNC(SYSDATE-LEVEL, 'IW') "Monday",
    TRUNC(SYSDATE-LEVEL, 'DAY') "NLS First day of week",
    MOD(TRUNC(SYSDATE-LEVEL, 'IW') - TRUNC(SYSDATE-LEVEL, 'DAY') + 7, 7) "1 if day 1 = SUN, 0 if MON"
    FROM DUAL CONNECT BY LEVEL <= 7;
    
    Monday   NLS First day of week 1 if day 1 = SUN, 0 if MON
    -------- --------------------- --------------------------
    31/12/12 31/12/12                                       0
    24/12/12 24/12/12                                       0
    24/12/12 24/12/12                                       0
    24/12/12 24/12/12                                       0
    24/12/12 24/12/12                                       0
    24/12/12 24/12/12                                       0
    24/12/12 24/12/12                                       0
    

    Or it could be simpler:

    ALTER SESSION SET NLS_TERRITORY = 'AMERICA';
    
    WITH DATA AS (SELECT LEVEL INPUT_DAY FROM DUAL CONNECT BY LEVEL <= 7)
    SELECT INPUT_DAY,
    TO_CHAR(TRUNC(SYSDATE, 'Day')+INPUT_DAY-1, 'DAY') "Day label"
    from data;
    
    INPUT_DAY Day label
    --------- ------------------------------------
            1 SUNDAY
            2 MONDAY
            3 TUESDAY
            4 WEDNESDAY
            5 THURSDAY
            6 FRIDAY
            7 SATURDAY
    
    alter session set nls_territory = 'FRANCE';
    
    WITH DATA AS (SELECT LEVEL INPUT_DAY FROM DUAL CONNECT BY LEVEL <= 7)
    SELECT INPUT_DAY,
    TO_CHAR(TRUNC(SYSDATE, 'Day')+INPUT_DAY-1, 'DAY') "Day label"
    from data;
    
    INPUT_DAY Day label
    --------- ------------------------------------
            1 MONDAY
            2 TUESDAY
            3 WEDNESDAY
            4 THURSDAY
            5 FRIDAY
            6 SATURDAY
            7 SUNDAY
    
  • How to get the difference in dates in days

    Hi friends,

    How to get the date difference between two dates exactly

    date2-date1 days exactly... shouyld rounded to the nearest value of...

    and one entire display i mean positive integer
    Select round ((sysdate) - to_date (date_start)), date_start days of per_periods_of_service

    This gives negative also result

    Hello

    776317 wrote:
    Hi friends,

    How to get the date difference between two dates exactly

    date2-date1 days exactly... shouyld rounded to the nearest value of...

    Date1 - date2 is the exact number of days is after date2 date1. (It is as accurate as possible, given that the DATEs do not have fractions of a second).

    and one entire display i mean positive integer
    Select round ((sysdate) - to_date (date_start)), date_start days of per_periods_of_service

    You want to probably get the exact number of days first, then ROUND this number:

    SELECT  ROUND (SYSDATE - TO_DATE (date_start, ...))   AS days
    FROM    per_periods_of_service; 
    

    Always pass arguments at least 2 to TO_DATE:
    (1) the string to be converted, and
    (2) a saying string how (1) is formatted

    This gives negative also result

    Right; If date1 is before date2 then date1 - date2 returns a negative number.
    If you want to never get a negative value, use ABS (date2 - date1). If it returns 4, then you know that one of the DATEs was 4 days before the other, but you won't know who was earlier.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

  • How to get the date in the exact day in the field when another?

    Hello

    Please help me how to get the day of the week using another date field.

    In fact, a field (week_day) has 1,2,3,4,5,6,7 here 1-, 2 - KILL like this.
    another field has the date. After this date, go to this particular week and need to pick up the date of the Etiquettemois above. It should be this week there himself.

    Thanks in advance!

    Kind regards
    Florian...

    Published by: Florian on October 29, 2010 03:07

    Maybe it's

    select trunc(date_field,'D') + week_field - 1 from table
    
  • How to get the video intro off my google home screen I already saw it, where is the firefox logo used to be.

    How to get the video intro off my google home screen I already saw it, where is the firefox logo used to be. I started with the last update that I rebooted.

    Hello
    to change the homepage when opening firefox-press 'Alt' and click on tools-> Options.

    Main menu, you can change the URL.

    If the problem persists, you can follow these simple steps:

    Enter about: config in the address bar and press ENTER. Accept the message of 'dragons' to see the Advanced preferences screen. Use the above search box to enter the below pref.

    You can assign an empty string to stop your Firefox to retrieve "extracts" and brandLogo changes the browser.aboutHomeSnippets.updateUrl pref. Right-click this pref and select Edit then clear the value as pref in the box that appears, and then click OK. Who will also disable "snippets" that appear under the container of the research on the default home page.

    Then you must open the folder of your profile, via help > Troubleshooting Information > profile folder > > button view folder. Then close Firefox. Your profile file open with Firefox closed (Firefox '3-bar' menu key > exit/Quit), wait or two minutes, then remove the storage\moz-safe-about + home folder in the Firefox profile folder to remove the brandLogo and stored in IndexedDB code snippets to make Firefox use the default brandLogo and a defined default code snippet.

    If you later change your mind about these changes, you can reset the pref browser.aboutHomeSnippets.updateUrl via the context menu and Reset allows to retrieve the default value using the storage\moz-chest-fort-about + home folder again.

  • 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 current timestamp in C++ to the BB10 project

    Please help me how to get the current timestamp in C++. Thanks for your help!

    Following your suggestion,

    QTime is only for a day.  http://developer.BlackBerry.com/Cascades/reference/QTime.html#details

    I found "QDateTime" of references of the API: http://developer.blackberry.com/cascades/reference/qdatetime.html#toTime_t

    QDateTime = now QDateTime::currentDateTime();
    timestamp long = now.toTime_t ();

    But I got an error. I searched but no results are clear:

    -variable 'QDateTime now' initializer has but
    incomplete type
    -type incomplete "QDateTime" used in the nested name
    specifier of

    I am a newbie. So thank you for your help

  • How to get the time of the device

    Hello

    I'm developing an application in which I send location of the device in lat, long for every 10 minutes.  I want to send some time also with lat, long. This time must be peripheral situation updates for every 10 minutes.  Can someone tell me how do I do this?

    It is not obvious to your OP exactly what you ask.

    Ask you in a certain way a consistent recording time no matter what time zone are you in?

    Or are you just asking how to get the date and time?

    If it's the last QDateTime is one of the ways to get the date and time...

    http://developer.BlackBerry.com/native/reference/Cascades/QDateTime.html

    If you ask for the first answer more complex, you will probably need to check the time against an external clock (say GMT) and then re-reading use the contact information you have saved to determine what the weather was (including a calculation of DST) at this point in this particular time zone.

    Relying on the phone to change accurately that it is time that you move in time zones will not give accurate results.

Maybe you are looking for

  • How can I connect to iCloud

    I have problems connecting to iCloud, after I enter my password, I get error connecting to server Apple ID. Any idears?

  • Audio tracks to follow tempo changes

    Hi all I'm really confused about something on Garage Band for iOS. Currently using an iPad with iOS 9.3.1 Pro 12.9. I started a new project, captured a loop of battery from another application (Anytune Pro in this case) and trimmed the loop so I coul

  • Cannot update of El Capitan 10.11.1 in 10.11.2

    I tried to download and update my iMac 10.11.1 in 10.11.2 (this update is for the Recovery Update 1.0 and El Capitan 10.11.2). My updated MBP to date very well without any problems. SIP (without roots) is disabled on my iMac and the MBP. I don't have

  • Pavilion 550-130: DVD - RW Slim power connector

    I changed my diet with a Rosewill new, I'm having a problem, power came not with one of the connectors that I need, I need to buy an adapter, but do not know the name of this connector, the connector that powers the DVD - RW drive, it looks like a re

  • Pavilion dv6 3170ec - koyboard

    I ve got laptop hp pavilion dv6 3170ec laptop. I´d would like to know if I can change some settings of my keyboard. For example, if I press F11, it turns off the sound. If I really want to press F11, I have to hold the function key 'fn' and press F11