Extract Month & Year  From Date

Hi All,
I have a key figure quantity and i want the data on date,for the month and for the year.
i create the variables for the date,for the month(ie from date to date) and for the year(ie, from date to date) seperatly that means i have three input variables which may sometimes create confusion.
My problem is that I want to enter only date and the variable itself calculate the month and year from the date so that it returns the data as desired above.
for eg. : Now i to enter date : 3/14/2009
          enter MTD (FROM/TO) : 3/01/2009 - 3/14/2009
          enter YTD (FROM/TO) : 4/01/2008 - 3/14/2009
I want to enter only date : 3/14/2009
and the variable itself extract the month and year till date.
and also the same variable calculates number of days so that need not to take the formula variable of date difference to calculate the average qty.
Neha..

Hi,
1. Create User Entry Variable on 0CALDAY : Name = ZCDAY.
2. Craete a Customer Exit Variable on 0CALDAY: Name  = ZMTD.
3. Craete a Customer Exit Variable on 0CALDAY: Name  = YMTD.
Properties of Customer Exit Variables.
Variable reporesents = Single
Variable Entry = Mandatory
Processing By = Customer Exit.
Character = Calender Day
Here I'm thinking that ZKF is your key figure.
In columns you create two selections one is for MTD and other is for YTD.
In MTD selection, drag and drop ZKF and Drag and Drop 0CALDAY and then Right Clcik and Restrict-->
Selection = Value Range. (In Between) and restrict with the follwoing Variables
[]ZMTD; ZCDAY.
In YTD selection, drag and drop ZKF and Drag and Drop 0CALDAY and then Right Clcik and Restrict-->
Selection = Value Range. (In Between) and restrict with the follwoing Variables
[]YTD; ZCDAY.
Then write the following code in I_STEP = 2.
DATA: ZT_DT1 TYPE SY-DATUM,
          ZT_DT2 TYPE SY-DATUM,
          ZT_SDT TYPE SY-DATUM,
          ZT_YR(4) TYPE N,
          ZT_DY(2) TYPE N,
          ZT_MT(2) TYPE N,
          ZE_TT(2) TYPE N,
          ZPOPER TYPE POPER,
         ZRELJR TYPE RELJR.
WHEN 'ZMTD_A'.
  LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
    IF sy-subrc = 0.
      CLEAR: l_s_range.
      ZT_DY = '01'.
      ZT_SDT = loc_var_range-low.
      ZT_MT = ZT_SDT+4(2).
      ZT_YR = ZT_SDT+0(4).
      CONCATENATE ZT_YR ZT_MT ZT_DY INTO ZT_DT1.
      l_s_range-low = ZT_DT1.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'EQ'.
      APPEND l_s_range TO e_t_range.
    ENDIF.
  ENDLOOP.
WHEN 'ZYTD'.
  LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
    IF sy-subrc = 0.
      CLEAR: l_s_range.
      ZT_DY = '01'.
      ZT_SDT = loc_var_range-low.
      CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
        EXPORTING
          I_DATE               = ZT_SDT
*         I_MONMIT             = 00
          I_PERIV              = 'V3'
       IMPORTING
         E_BUPER              = zbuper
         E_GJAHR              = zbdatj
       EXCEPTIONS
         INPUT_FALSE          = 1
         T009_NOTFOUND        = 2
         T009B_NOTFOUND       = 3
         OTHERS               = 4
      IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
        EXPORTING
          I_GJAHR              = zbdatj
          I_PERIV              = 'V3'
       IMPORTING
         E_FIRST_DAY          = ZT_DT2
*         E_LAST_DAY           =
       EXCEPTIONS
         INPUT_FALSE          = 1
         T009_NOTFOUND        = 2
         T009B_NOTFOUND       = 3
         OTHERS               = 4
      IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      l_s_range-low = ZT_DT2.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'EQ'.
      APPEND l_s_range TO e_t_range.
    ENDIF.
  ENDLOOP.
Thanks
Reddy

Similar Messages

  • How to derive month/year from date in SAP BW 3.5 data flow

    Hi
    How we can derive cal year/month and fiscal month/year from date in SAP BW 3.5 data flow (we're using transfer and update rule)..
    Thanks,
    PK

    Hi,
    if you have any date filed in source side you can just map to any time char system will automatically convert to target objects.
    please look at the screen shot for understanding. (not 3.x it is 7.x)
    Thanks,
    Phani.

  • How to Calculate column (Month, Year) from date or timestamp

    Hi,
    Name
    SQL Data Type
    Dimension
    Column Store Data Type
    Key
    Not Null
    Default
    Comment
    T_STAMP
    TIMESTAMP
    LONGDATE
    How to generate Month and Year from timestamp field in Analytic View.
    Please provide me some valuable input. I have searched SCN before posting this discussion.

    Hi KD,
    You can apply the following formulas in the expression:
    For Year :
    leftstr(string("Timestamp"),4)
    For Month:
    midstr(string("Timestamp"),6,2)
    Regards,
    Krishna Tangudu

  • Extract month part from date

    hi,
    I have a query in Informix which get the month part of a date. Please help me in converting the same to oracle.
    Informix query
    select month(col1 - today) from tab1;
    col1 is a date field, today will yield the current date and month function will get the month of the date.
    In oracle, when we subtract two dates we will get a number value, how to convert that back to date and extract the month part.
    Help me?????
    Regards,
    Gopu

    If your looking for the number of months between two dates:
    SQL> select months_between(sysdate, trunc(sysdate,'yyyy')) from dual ;
    MONTHS_BETWEEN(SYSDATE,TRUNC(SYSDATE,'YYYY'))
    6.06223081
    Just replace my usage of sysdate (etc) with the dates your using...
    Hope that helped,
    Stan

  • Group by month/year from DATE FORMAT column

    Hi Chaps,
    I have a recordset that pulls data from a database, then presents the data in a table. The data is grouped by 'projid', repeated for every 'projid', with a show/hide control, to show all the 'jobid's' relating to that particular 'projid'
    This is what I have so far:
    Code:
    SELECT             
    tbl_projects.projid,
    tbl_projects.projtitle,
    tbl_projects.projdue, DATE_FORMAT(tbl_projects.projdue, '%%d/%%m/%%Y') as projdue_format,
    tbl_projects.projtype, 
    tbl_projects.projinvtype,
    tbl_projects.FK_custid,
    tbl_projects.projcompletedate
    tbl_languaget.langtname,
    tbl_doctype.doctypename,
    tbl_jobs.jobid,
    tbl_jobs.FK_projid,              
    tbl_jobs.jobname,              
    tbl_jobs.FK_langid,              
    tbl_jobs.jobpages,              
    tbl_jobs.jobshipped,
    tbl_jobs.jobinvsent,   
    tbl_jobs.jobtranslatorcharge,    
    'tbl_jobs' as fromtable,
    tbl_customers.custid,
    FROM tbl_projects  
    INNER JOIN tbl_jobs              
    ON tbl_projects.projid=tbl_jobs.FK_projid  
    INNER JOIN tbl_languaget              
    ON tbl_languaget.langtid=tbl_jobs.FK_langid  
    INNER JOIN tbl_customers              
    ON tbl_customers.custid=tbl_projects.FK_custid
    INNER JOIN tbl_costs
    ON tbl_costs.FK_custid=tbl_customers.custid 
    INNER JOIN tbl_doctype
    ON tbl_doctype.doctypeid=tbl_jobs.FK_doctypeid
    WHERE tbl_projects.projstatus='Complete'        
    AND tbl_projects.projinvtype='Costing Sheet'
    AND langtname!='TH'
    AND langtname!='ID'
    AND langtname!='KO'
    AND langtname!='JP'
    AND jobinvsent='y'
    AND FK_custid = %s
    ORDER BY projid ASC", GetSQLValueString($colname_rsInvPending, "int");
    $rsInvPending = mysql_query($query_rsInvPending, $conndb2) or die(mysql_error());
    //$row_rsInvPending = mysql_fetch_assoc($rsInvPending);
    $totalRows_rsInvPending = mysql_num_rows($rsInvPending);
    Code:
    // REPEAT - FOR EVERY PROJECT
      <?php
      $previousProject = '';
      if ($totalRows_rsInvPending > 0) {
      // Show if recordset not empty
        while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
          if ($previousProject != $row_rsInvPending['projid']) {
          // for every Project, show the Project ID
      ?>
    Code:
    // SHOW/HIDE CONTROL
        <tr>
        <td colspan="9" class="highlight"><span class="blueBold"><a href="#" onclick="toggle2('proj1<?php echo $row_rsInvPending['projid'] ?>', this)"><img src="../../Images/plus.gif" border="0" /></a> <?php echo $row_rsInvPending['projid'] ?> - </a></span><span class="blueNOTBold"><em><?php echo $row_rsInvPending['projtitle'] ?></em></span></td>
        </tr>
    Code:
    // SHOW/HIDE
        <?php $previousProject = $row_rsInvPending['projid']; } ?>
        <tr class="proj1<?php echo $row_rsInvPending['projid'] ?>" style="display:none">
        <td>column 1</td>
        <td>column 2</td>
    What I want, is to put in another grouped by stage, where the 'projid's' themselves are in a show/hide region, grouped by 'projcompletedate' (year/month). 'projcompletedate' is in DATE format, but how to I get PHP/SQL to take the month and year and then group them correctly?

    Hi David, I'm not sure if I've got this right, would you mind looking at my latest code?:
    <table border="0" cellpadding="0" cellspacing="0" id="tblinvoice">
        <tr>
          <th>Job Title</th>
          <th>Type</th>
          <th>Language</th>
          <th>Translator</th>
          <th>Total</th>
          <th>Full</th>
          <th>Fuzzy</th>
          <th>Proof</th>
          <th>Full Price</th>
          <th>Discount Price</th>
          <th>Document Format</th>
          <th>Pages</th>
          <th>Typesetting Cost</th>
          <th>EN Proofreading Cost</th>
          <th>Total</th>
          <th>Translator Charge</th>
          <th>Profit</th>
          <th>Profit Percentage</th>
        </tr>
        <?php
          $previousMonth = '';
          if ($totalRows_rsInvPending > 0) {
          // Show if recordset not empty
          do ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
          if ($previousMonth != $row_rsInvPending['themonth']) {
          // for every Month, show the Month Name
       ?>
        <tr>
          <td colspan="18" class="highlight"><?php echo $row_rsInvPending['theyear'] ?> - <?php echo $row_rsInvPending['themonth'] ?></td>
        </tr>
        <?php $previousMonth = $row_rsInvPending['themonth']; } ?>
        <?php
          $previousProject = '';
          if ($totalRows_rsInvPending > 0) {
          // Show if recordset not empty
          while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
          if ($previousProject != $row_rsInvPending['projid']) {
          // for every Project, show the Project ID
       ?>
       <tr>
        <td colspan="18" class="highlight"><span class="blueBold"><a href="#" onclick="toggle2('proj1<?php echo $row_rsInvPending['projid'] ?>', this)"><img src="../../Images/plus.gif" border="0" /></a> <?php echo $row_rsInvPending['projid'] ?> - </a></span><span class="blueNOTBold"><em><?php echo $row_rsInvPending['projtitle'] ?></em></span></td>
        </tr>
        <?php $previousProject = $row_rsInvPending['projid']; } ?>
        <tr class="proj1<?php echo $row_rsInvPending['projid'] ?>" style="display:none">
            <td><?php echo $row_rsInvPending['jobname']; ?></td>
            <td><?php echo $row_rsInvPending['projtype']; ?></td>
            <td><?php echo $row_rsInvPending['langtname']; ?></td>
            <td><?php echo $row_rsInvPending['translator']; ?></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <?php } while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)); ?>
          <?php } // Show if recordset not empty ?>

  • Extract year from date

    Hello,
    Iam using obiee 11g, would like to extract the year from date
    CAST(YEAR("ABC"."DATEADDED" ) as varchar(4))
    so used like this
    But i want like if the year is 2011 then only 11 i wants is there a direct function which does that.
    Thanks

    You can use the right function right(year, 2). Will return 11 if year is 2011

  • Extract Year/Month/ Week From Date

    BW Experts,
      I have a Time Char in a New OSD i am developing. Say the Time char is 0Req_date. This 0req_date is updated using some calculation in my update rules (Say 0Req_Date = Act_dl_dt - Conf_date). Now I have to extract month/ year/ week and populate Time Chars 0REQ_MONTH, 0REQ_YEAR and 0REQ_WEEK respectively from 0REQ_DATE. Can I do this via respective rules to 0REQ_MONTH, 0REQ_YEAR and 0REQ_WEEK in the update rules. My concern is as OREQ_DATE itself is a calculated field, can month/year/week be extracted correctly? Hope I have put the question across understandably. Help is appreciated.
    Thanks
    Ashwin

    Hi Ashwin,
    It can be done...you can either put the code for all these derivations in the Start Routine of the update rule, making sure that the 0REQ_Date is calculated before the others. Or you can also calculate just the 0REQ_DATE in the start routine and use the individual update routines to populate the other time chars.
    Processing using the Start Routine is recommended for efficiency and better performance.
    Hope this helps...

  • Rip of year from date field

    I have a question. I want to rip of the year from date field. For e.g if date is 01/02/2006 I want just the 01/02 which month and date. I tried to use substr function but it;s giving weird result. I used substr(date, 0,5) but not working. Please suggest.

    If it is a DATE column/variable it is conventional to use TO_CHAR with an appropriate date format, in your case TO_CHAR (date_column, 'MM/YY').

  • Select year from date

    help me..urgent..
    how set query to select year from date by using expression where.
    ex: select sum(salary)
    from table
    where year(date)=2007
    group by name;
    just something like that..help me.plezz..

    select *
      from (
             select 1 as rn, to_date('09052007','ddmmyyyy') as dt from dual union all
             select 1 as rn, to_date('09052006','ddmmyyyy') as dt from dual
    where to_char(dt,'yyyy') = '2007'; or
    select *
      from (
             select 1 as rn, to_date('09052007','ddmmyyyy') as dt from dual union all
             select 1 as rn, to_date('09052006','ddmmyyyy') as dt from dual
    where extract(year from dt) = 2007;

  • Error in running Extract Definition Upload from Data File concurrent.

    Hi all,
    Am trying to upload the 834 Extract Layout from the data file by running the concurrent program, Extract Definition Upload from Data File.
    After running this concurrent program am getting the Extract Layout definition with Record layout and Data elements within it.
    But some record layouts has the changes at their repeating level in that.
    Please suggest me how do i get the same repeating levels for the record layouts when i move the 834 benefit extract layout definition
    from one instance to another instance.

    Hi,
    We have exactly the same error in IBolt. This error happens sometime and we don't find the reason.
    IBolt has been upgraded to Version 3.1 SP1 and a fix has been developed by the support. After installation, we've work hardly during 2 days for testing all the flows by the customer without having this error.
    Ibolt works as a service and when this error occurs, the service stopped and must be restarted.
    In our flows, we have put a delete of the observer.dll file just before the rest of the flow but it doesn't solve the problem.
    Deleting the directory can be temporarly a solution but the error come back another day.
    Each time the SBO client or DTW is started, the %temp%\SMS_OBJ_DLL directory is created...
    When you just delete the observer.dll file and leave the rest of the directory like it is, the file is re-created when you start and log to SBO. I would say that this file is a copy of another file observer_800178.dll (800178 depending of the version of SBO yoi have). 800178 corresponds to SBO 2007 A PL 42.
    Do you have more information since your post has been send ?
    Thanks in advance for your help.
    Best regards.

  • Year , Month & Day from Date.

    Hi HANA experts,
      Do help me to resolve this issue
    How can we extract or fetch year from the date.i went through some of the SCN blogs.where they create calculation views...but the steps are not that clear to me.
    can anyone please explain??
    My scenario is :
    I have date field in ANALYTIC VIEW which i have fetched from ECC  tables.
    now i need to get  the year  wise month wise and day wise reports. so what steps i should do in calculation view to get that??
    thanks
    Neeraja

    there is no ECC under SAP...as we are using suite on HANA fro AWS.and there is no restriction done by the basis till now...
    as we are new to these unable to trouble shoot things easily.
    thanks for your reply..

  • Spread Data Over Multiple Months & Years with Data from Multiple Years

    Hello Everyone,
    I have a complex calculation for spreading values over several months spanning mulitle years. Because we have a 36 month rolling Forecast, a more sophisticated calc is required as opposed to hard coding months or years.
    Heres the description:
    Users enter the following data,
    FY11     BegBalance     Number of BOD Members     10
              BOD Options Vesting Months     20
              BOD Options Accounting Value     10
              BOD Options- Number of Shares     100
              BOD Grant Month     Aug
    FY12     BegBalance     Number of BOD Members     5
              BOD Options Vesting Months     10
              BOD Options Accounting Value     5
              BOD Options- Number of Shares     200
              BOD Grant Month     Oct
    FY13     BegBalance     Number of BOD Members     20
              BOD Options Vesting Months     8
              BOD Options Accounting Value     20
              BOD Options- Number of Shares     100
              BOD Grant Month     Feb
    Based on the above;
    "BOD Stock" is calculated as following/month=Number of BOD Members*BOD Options Accounting Value*BOD Options- Number of Shares/ BOD Options Vesting Months
    Start month for the above is based on "BOD Grant Month". So, for instance considering data for FY11:
    The total "BOD Stock" value is $10000 (originating from FY11) with start month of AUG in FY11 and the number of months to spread over is 20 months. So, essentially the "BOD Stock" per month (originating from FY11) is $500 starting from AUG FY11 to Mar FY13.
    Similarly, the total "BOD Stock" value is $5000 (originating from FY12) with start month of OCT in FY12 and the number of months to spread over is 10 months. So, essentially the "BOD Stock" per month (originating from FY12) is $500 starting from OCT FY12 to JUL FY13.
    The challange I am facing is because of the number of months to spread. Because I have data to spread from multiple years and each year's data spills into the following years, each year should accumulate data from prior years. For instance;
    FY11 should include only FY11
    FY12 should include FY11 and FY12
    FY13 should include FY11, FY12 and FY13.
    Could anyone suggest a smarter way to do this without writting code for each year, maybe using @MDALLOCATE function? The following shows how data should be spread and accumulated.
                             BegBalance     Jan     Feb     Mar     Apr     May     Jun     Jul     Aug     Sep     Oct     Nov     Dec     Period
    FY11     Number of BOD Members          10     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Vesting Months          20     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Accounting Value     10     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options- Number of Shares     100     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Grant Month               Aug     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
              BOD Stock               10000     #mi     #mi     #mi     #mi     #mi     #mi     #mi     500     500     500     500     500     #mi
    FY12     Number of BOD Members          5     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Vesting Months          10     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Accounting Value     5     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options- Number of Shares     200     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Grant Month               Oct     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
              BOD Stock               5000     500     500     500     500     500     500     500     500     500     1000     1000     1000     #mi
    FY13     Number of BOD Members          20     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Vesting Months          8     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Accounting Value     20     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options- Number of Shares     100     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Grant Month               Feb     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
              BOD Stock               40000     1000     6000     6000     5500     5500     5500     5500     5000     5000     #mi     #mi     #mi     #mi
    Appreciate your inputs!
    Edited by: user10678366 on Oct 12, 2010 3:21 PM

    Why not use substitution variables for Years? you could have something like &Year1, &Year2, &Year3
    Cheers

  • Getting Day, month and year from Date object

    hello everybody,
    Date mydate = Resultset.getDate(indexField);
    Now i would like to get day, month and year from mydate.
    In another words, i'm looking for something equivalent to
    mydate.getDay() as this method is deprecated.
    Can somebody help me out please?
    Thank you in advance,

    swvc2000,
    Here is a sample class that demonstrates two ways in which to do this.import java.util.*;
    import java.text.*;
    public class DateSplitter {
       public static void main(String args[]) {
          /* even though your date is from a result set,
             pretend the following date is your date that
             you are using. The try catch block is used
             because I hand-crafted my date using
             SimpleDateFormat.  Substitute your date.*/
          Date yourDate = null;
          try {
             SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
             yourDate = formatter.parse("05/06/2000");
          } catch (ParseException e) { }
          //the following gets the current date
          Calendar c = Calendar.getInstance();
          //use the calendar object to set it to your date
          c.setTime(yourDate);
          //note months start at zero
          int month = c.get(Calendar.MONTH);
          int year = c.get(Calendar.YEAR);
          int dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
          System.out.println("Calendar Month: "+month);
          System.out.println("Calendar Day: "+dayOfMonth);
          System.out.println("Calendar Year: "+year);
          System.out.println();
          /* Simple date format can also be used to strip them
             out of your date object.  When you use it, notice that
             months start at 1.  Also, it returns string values.  If
             you need integer values, you will have to use
             Integer.parseInt() as I did below.  If you are
             only concerned about the string values, just remove
             the Integer.parseInt part. */
          DateFormat formatter = new SimpleDateFormat("M");
          month = Integer.parseInt(formatter.format(yourDate));
          System.out.println("SDF Month: "+ month);
          formatter = new SimpleDateFormat("d");
          dayOfMonth = Integer.parseInt(formatter.format(yourDate));
          System.out.println("SDF Day: "+ dayOfMonth);
          formatter = new SimpleDateFormat("yyyy");
          year = Integer.parseInt(formatter.format(yourDate));
          System.out.println("SDF Year: "+ year);
       }//end main
    }//end DateSplitter classtajenkins

  • Get month and year from date type

    Hi all,
    I need to get the month and year from the date type.
    For example select to_date('2011-01-17', 'yyyy-mm-dd') from dual;Result needed:
    01-2011Any ideas?
    thanks in advance,
    Bahchevanov.

    Hello Bahchevanov,
    if you need the date to compute something, then you can
    TRUNC(SYSDATE,'mm')This will give you a date with the days removed -> 01.01.2011
    Regards
    Marcus

  • How to extract month number from a column in a table

    select extract(MONTH FROM DATE to_char(a.creationdate)) from mytable a doesn't work . plz tell me what is wrong with this. is there another way to get the month in a numeric form apart from this.

    Hi
    SQL> SELECT TO_NUMBER(TO_CHAR(TO_DATE('March', 'Month'), 'MM')) MONTH_NUM FROM DUAL;
    MONTH_NUM
    3
    SQL> SELECT TO_NUMBER(TO_CHAR(TO_DATE('December', 'Month'), 'MM')) MONTH_NUM FROM DUAL;
    MONTH_NUM
    12
    SQL> SELECT TO_NUMBER(TO_CHAR(TO_DATE('August', 'Month'), 'MM')) MONTH_NUM FROM DUAL;
    MONTH_NUM
    8
    This is what you want to do?
    Hope it helps
    Regards,
    Tony G.

Maybe you are looking for

  • In the Code Modus how I see how many characters I typed in ?

    Hello from Munich Germany, How can I have with Dreamweaver CS3 Windows Version In the Editor Code-Modus – when I write characters from left to right – that Dreamweaver COUNT ME the number of characters. Therefore I was using Microsoft Expression Web

  • Service PO confirmation using BAPI

    Hi Frndz, I have created a Subcontracting Info Record for matl. group and Vendor. This info. record number will be used by an operation in the Routing to create a service PR when I create a Production order. From this PR we will create a service PO.T

  • Is it possible to integrate an existing, up to date, XP Pro OS on my computer into a new install of Win 7?

    I read that Win 7 security support will last until 2020. I am considering moving from Win XP Pro to Win 7 Pro with XP mode instead of Win 8.1, because the Win 7 upgrade adviser indicates no problems, whereas when I run the Win 8 upgrade adviser there

  • CKeditor in database application

    Hi all, I'm using the rich text editor (CKeditor) in my application, mostly for inserting special characters. The data is stored in the database along with the HTML tags etc, how can I retrieve that data for example in a report/ display only field, w

  • Updated to Maverick. Can not open many PDFs now.

    I updated my Mac to Maverick last night. This morning I went  to open a PDF and got an error: I get this error with every PDF in this directory. I have found I can open PDF's in other directories fine. I can open the PDF's in Illustrator, Photoshop a