How To Get Only Month or Only Year from datetime format of yyyy-mm-dd

Hi SQL gurus,
I have field has datetime format of yyyy-mm-dd (ie. 2014-11-28).  Could anyone please educate me on how to extract only month (ie. November but not 11) and only year (ie, 2014) from 2014-11-28.  I writing two report have title of Number of
sick leaves on November  and Number of sick leaves in 2014.  I am planning to extact 11 from 2014-11-28 and display as November on report title and the same goes for 2014.  Unless you have better non complicated way.   Thank you
very much in advance.  DingDong!!

There are multiple ways
Month name
SELECT DATENAME(mm,@DateParam)
SELECT FORMAT(@DateParam,'MMMM')
Year
SELECT FORMAT(@DateParam,'yyyy')
SELECT DATEPART(yy,@DateParam)
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • How to get the week number of year from a Date object?

    Hi!
    I would like to know the week number of the year from a specified Date.
    I dont know how to set the first day of week, and set the minimum days of a week.
    I want to use Monday for first day of week, and at least 4 days of month in a week.
    For example if its 1st, January is Friday, then the first week starts on 4th, Monday.
    Anyone can help?

    Sorry. I should think before I move.
         public static int getWeekOfYear(Date date) {
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(date);
             calendar.setFirstDayOfWeek(Calendar.MONDAY);
             calendar.setMinimalDaysInFirstWeek(4);
             return calendar.get(Calendar.WEEK_OF_YEAR);
         }

  • How to get the list of only installed bundled application on mac os X through programmatically???

    how to get the list of only installed bundled software on mac os X through programmatically???

    I think what you get is below;
    App Store
    Calculator
    Calendar
    Contacts
    Dashboard
    Dictionary
    DVD Player
    FaceTime
    Font Book
    Game Center
    Image Capture
    iTunes
    Launchpad
    Mail
    Messages
    Notes
    Photo Booth
    Preview
    QuickTime Player
    Reminders
    Safari
    Stickies
    System Preferences
    TextEdit
    Time Machine
    Twitter
    Activity Monitor
    AppleScript Editor
    Audio MIDI Setup
    Bluetooth File Exchange
    Boot Camp Assistant
    ColorSync Utility
    Console
    DigitalColor Meter
    Disk Utility
    Grab
    Grapher
    Keychain Access
    Migration Assistant
    Network Utility
    RAID Utility
    System Information
    Terminal
    VoiceOver Utility
    X11
    XQuartz
    Note if you buy a new Mac with ML preinstalled the list may be larger.

  • How to get folder(directory path only not file path) from local file system

    Hi Firends,
    How to get folder(directory path only not file path) from local file system , whenevr i will click on browse button.
    Please give reply for this one , if anybody knows.
    Thanks,
    Anderson.

    Hi Anderson,
    if you're using flash.filesystem.FileReference - then it is run in black box - except of filename, size and creation data (and few other properties available after some operation succeeded). This is part of security features in Flash runtime (described in header section):
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
    This for example implies that user can download a content to local machine - but that content cannot be loaded back into Flash runtime. For this you would need either Air runtime flash.filesystem.File:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml
    (so you would created Air runtime based application: desktop or mobile but not web, even as standalone project) or you would need one of 3rd party tools that add file access/file information features to standard Flash runtime applications converted to standalone native applications.
    hth,
    kind regards,
    Peter

  • How to get the monthly interest rate

    Hello!
    I have been using AppleWorks for 10 years.
    Since that time, I use a financial template named Mortgage Analyser.
    In this file, one can get the pmt if one provided the +pv, monthly interest rate and the number of periods.+
    What I get is the reverse, that is, how to get the +monthly interest rate+, if I provide the +pv, the number of periods and the pmt+?
    I think I had this in the past, but I can not find it.
    Thanks,
    Jorge Lucas (the guy from Rio Grande do Sul)

    Peter,
    I already saw that, but it does not give me what I want.
    That works only if you put a money at a savings account and DO NOT TOUCH IT for a given period.
    My need right now is to help a girl to buy a car in 36 or 48 monthly payments and calculate the real interest.
    I want to have this for any other similar buying.
    I can do it using the Mortgage Analyser template changing the MONTHLY RATE by *+try and error+* but — +since I am a High School Math Teacher+ — I would like to have the function directly.
    Another day I was looking on the Internet and it seems that there is no direct response for what I want, using AppleWorks.
    So, if I continue to use AW, I must calculate it by try and error.
    Thanks anyway!
    Jorge Lucas (the guy from Rio Grande do Sul)

  • How to get Open Balance for the year and Total Ending Balance?

    For a given account, how to get Open Balance for the year (Cumulative Ending Balance) and Total Ending Balance (Cumulative Ending Balance)?
    Is there any function module available? or should I read from some tables? Please advice.

    Hello Paul,
    You could try calling one of the following BAPIs - see which one meets your requirement. They are documented well so shouldn't be a problem finding out the correct one for your requirements.
    BAPI_GL_GETGLACCBALANCE      
    BAPI_GL_GETGLACCCURRENTBALANCE
    BAPI_GL_ACC_GETBALANCE      
    BAPI_GL_ACC_GETCURRENTBALANCE
    BAPI_GL_ACC_GETPERIODBALANCES
    BAPI_COND_VAL_DECRE_BALANCES
    You might have to put in some of your own logic after the BAPI call to get what you want.
    Hope this helps,
    Cheers,
    Sougata.
    p.s. Also look at FM FAGL_GET_ACCOUNT_BALANCE
    Edited by: Sougata Chatterjee on May 7, 2008 11:47 AM

  • How to get or set default fiscal year value in billing doc

    Hi All, my question is simple, how to get or set default fiscal year value (VBRK_GJAHR) in billing document.. is it possible.
    Thanks.
    Regards,
    Michael

    Hi Michel
    If you feel that the fiscal year value should come  in the billing document then you have to use a user exit USEREXIT_NUMBER_RANGE .
    As this is a related to ABAP , you should give the inputs and ABAP'ers will give the number range as per our requirement .
    Regards
    Srinath

  • How to get current month and last month dynamically??

    how to get current month and last month dynamically
    like
    month = getCurrentMonth();
    lastmonth = getcurrentMonth() -1;
    please help
    thanks

    hi :-)
    /* depracated but can be still useful */
    java.util.Date dtCurrent = new java.util.Date();
    int month = dtCurrent.getMonth();
    int lastmonth = dtCurrent.getMonth() - 1;
    System.out.println("* " + month);
    System.out.println("* " + lastmonth);
    /* better to use this one */
    Calendar cal = new GregorianCalendar();     
    int imonth = cal.get(Calendar.MONTH);
    int ilastmonth = cal.get(Calendar.MONTH) - 1;
    System.out.println("*** " + imonth);
    System.out.println("*** " + ilastmonth);
    regards,

  • I update my IPhone4 to IOS6 from IOS4.3.3. My all songs are missing in the Iphone4. How to get those songs into my Iphone from ITunes. Even after sync also not coming to IPhone.

    I update my IPhone4 to IOS6 from IOS4.3.3. My all songs are missing in the Iphone4. How to get those songs into my Iphone from ITunes. Even after sync also not coming to IPhone.

    The iphone is not  storage/backup device.
    The sync is one way - computer to iphone.
    The only exception is itunes purchases.  File>Devices>Transfer Purchases
    You should copy everything from your old computer, or your backup copy of your old computer, to your new one.

  • How to get standard program ,script,smartforms all from sap

    hi friends
    how to get standard program ,script,smartforms all from sap.
    thanks&regards
    Babasish

    Hi,
    reports:
    goto se38
    all programs not starting with y or z will be sap std programs only
    same for se71 scripts
    samse for smartforms
    but the use of those will be known when you see the documentation
    for each programme
    for std programs there will be documentation available so that you can understand
    why they have developed that object
    thanks & regards,
    Venkatesh

  • How to get the values of Select-options from the screen.

    The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.

    Hi,
    Refer this following code..this will solve your problem...
    "Following code reads value entered in s_po select options and willprovide search
    "help for s_item depending upon s_po value.
    REPORT TEST.
    TABLES : ekpo.
    DATA: BEGIN OF itab OCCURS 0,
    ebelp LIKE ekpo-ebelp,
    END OF itab.
    SELECT-OPTIONS   s_po FOR ekpo-ebeln.
    SELECT-OPTIONS s_item FOR ekpo-ebelp.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
      DATA:
      dyn_field TYPE dynpread,
      temp_fields TYPE TABLE OF dynpread,
      zlv_dynpro TYPE syst-repid.
      zlv_dynpro = syst-repid.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname     = zlv_dynpro
          dynumb     = syst-dynnr
          request    = 'A'
        TABLES
          dynpfields = temp_fields
        EXCEPTIONS
          OTHERS     = 0.
      LOOP AT temp_fields INTO dyn_field.
        IF dyn_field-fieldname EQ 'S_PO-LOW'.
            SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
            WHERE ebeln EQ dyn_field-fieldvalue.
            EXIT.
        ENDIF.
      ENDLOOP.

  • How to get an ArrayList Object in servlet from JSP?

    How to get an ArrayList Object in servlet from JSP?
    hi all
    please give the solution for this without using session and application...
    In test1.jsp file
    i am setting values for my setter methods using <jsp:usebean> <jsp:setproperty> tags as shown below.
    After that i am adding the usebean object to array list, then using request.setAttribute("arraylist object")
    ---------Code----------
    <jsp:useBean id="payment" class="com.common.PaymentHandler" scope="request" />
    <jsp:setProperty name="payment" property="strCreditCardNo" param="creditCardNumber" />
    <%-- <jsp:setProperty name="payment" property="iCsc" param="securityCode" /> --%>
    <jsp:setProperty name="payment" property="strDate" param="expirationDate" />
    <jsp:setProperty name="payment" property="strCardType" param="creditCardType" />
    <%--<jsp:setProperty name="payment" property="cDeactivate" param="deactivateBox" />
    <jsp:setProperty name="payment" property="fAmount" param="depositAmt" />
    <jsp:setProperty name="payment" property="fAmount" param="totalAmtDue" /> --%>
    <jsp:useBean id="lis" class="java.util.ArrayList" scope="request">
    <%
    lis.add(payment);
    %>
    </jsp:useBean>
    <%
    request.setAttribute("lis1",lis);
    %>
    -----------Code in JSP-----------------
    In testServlet.java
    i tried to get the arraylist object in servlet using request.getAttribute
    But I unable to get that arrayObject in servlet.....
    So if any one help me out in this, it will be very helpfull to me..
    Thanks in Advance
    Edward

    Hi,
    Im also facing the similar problen
    pls anybody help..
    thax in advance....
    Litty

  • How to get the last version of flash in MSI format automatically?

    How to get the last version of flash in MSI format automatically?
    Roberto Neigenfind
    Bravo Tecnologia
    www.bravotecnologia.com.br

    Hi Barbara,
    Flash Professional CS5.5 is a 32-bit application which can be installed on computers with either 32-bit or 64-bit operating systems.
    You can purchase this by Adobe's backward Licensing policy :
    " Adobe allows program members to order a current-version license but use a prior version. These members can contact Adobe Customer Service to request a serial number for the earlier version if they do not already have one. Prior-version software is available via ESD and can be purchased through standard resellers. The program member must follow all guidelines of the current-version EULA. "
    Please check the doc : http://www.adobe.com/volume-licensing/policies.html

  • How to get the current logged in username from windows and put it into an AS var

    Hello,
    I was hopeing someone would know how to get the current logged in username from windows and put it into a var, so I can create a dynamic text box to display it.
    Thanks in advance
    Michael

    Just for everyone’s info, this is the script I have used to get the logged in windows username into flash ---- not and air app.
    In the html page that publishes with the .swf file under the <head> section:-
    <script language="JavaScript" type="text/javascript">
    function findUserName() {
         var wshell=new ActiveXObject ("wscript.shell");
         var username=wshell.ExpandEnvironmentStrings("%username%");
         return username;
    </script>
    The ActionScript:-
    import flash.external.ExternalInterface;
    var username:String = ExternalInterface.call ("findUserName");
    trace (username); // a quick test to see it in output

  • HT3702 i want to change my region and i don't know how to get rid of the remaing amout from my gift card ($0.48)

    i want to change my region and i don't know how to get rid of the remaing amout from my gift card ($0.48)

    Request that iTunes Support zreo balance your account.
    iTunes Support -
    http://www.apple.com/support/itunes/

Maybe you are looking for