XSLT Mapping: how to calculate Week number of the year from given date

Hi,
I  have input as date, i need to know the Week number from that date in XSLT Coding.
for Eg: if date is 29-12-2009 it should give 53rd week of the year.
All answers will be appreciated.
Regards,
Mayank

Hi add this statement to your XSLT Mappping
<xsl:stylesheet version="1.0" xmlns:java="http://xml.apache.org/xslt/java" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="java">
and use <xsl:template name="GetDateInLocal" xmlns:cal="xalan://java.util.GregorianCalendar"> in XSLT Mapping , write your logic.
cheers,
Raj

Similar Messages

  • How to calculate week number from system date

    Hi experts,
    how to calculate week number from system date  ?
    thanks.
    SK

    hi,
    The above FM can be used for BADI or customer exit, if it is design level then you can use formula as well, under formula date functions you can use DATE_TO_WEEK.
    regards,
    Arvind.

  • How to calculate a number of calendar days from a start date (e.g. 60 days from 3/10/2012)

    How to calculate a number of calendar days from a start date (e.g. 60 days from 3/10/2012)

    DT,
    If the starting date is in Column A, and you want to calculate what the date would be 60 days later, in Column B, write in Column B:
    =A+60
    Couldn't be much easier.
    Jerry

  • How do I pull just the year from a date?

    I'm trying to pull just the year from a date and cannot figure out how this can be done. I tried the SUBSTR fuction but its not acting how I would expect. What I'm wanting to do is write a condition that says Item Birth Year = Current Year minus 23 I have a calc that figures the age from the difference in the birthdate and current year but I'd really like to just write a condition based just one years. Can this be done?

    Hello
    SUBSTR will only work on a string. To extract portions of a date you need to use the TO_CHAR command.
    To get the year you would use this: TO_CHAR(the_date,'YYYY')
    TO_CHAR takes 2 switches, the date to be manipulated and the portion to be extracted, with the portion in single quotes.
    Once you get used to manipulating dates like this other common pieces are: DD - extracts the day of the month, MON extracts the 3 character code for the month.
    Thus you can use this: TO_CHAR(sysdate,'DD-MON-YYYY') and it will convert the current date, June 7th 2012 to 07-JUN-2012
    Hope this helps
    Best wishes
    Michael

  • How to get a week number  for the year using oracle sql query?

    hi everyone,
    i have the requirement to find the week number for the calender..
    so that week number should start with 01 when the year starts and it should end with week end date(that is first saturday of the january month).. so next week number starts with sunday and ends with saturday ,continously.. in the end date of the year it should not be 'saturday' but week number should end with last date of the year.. again in the next year it should start with '01'.
    for example:
    01-JAN-13 tuesday 01
    02-JAN-13 wednesday 01
    03-JAN-13 thursday 01
    04-JAN-13 friday 01
    05-JAN-13 saturday 01
    06-JAN-13 sunday 02
    07-JAN-13 monday 02
    26-DEC-13 thursday 52
    27-DEC-13 friday 52
    28-DEC-13 saturday 52
    29-DEC-13 sunday 53
    30-DEC-13 monday 53
    31-DEC-13 tuesday 53
    01-JAN-14 wednesday 01
    02-JAN-14 thursday 01
    how can i achieve this, can anyone please help me out on this..
    i have a query that starts with 01 when year starts but it gives problem in the end of the year .. described below with a query..
    select mydate,
    to_char(mydate,'day') as weekday,
    to_char(next_day(mydate,'sunday'),'iw') as week_num
    FROM ( SELECT TRUNC (SYSDATE, 'yy') - 1 + LEVEL AS mydate
    FROM dual
    CONNECT BY LEVEL <= (SELECT TRUNC (ADD_MONTHS (SYSDATE, 24), 'yy')
    - TRUNC (SYSDATE, 'yy')
    FROM DUAL))
    this query gives date, weekday and week_num for 2 years 2013 and 2014,
    when i run this query ,at the end of the 2013 it gives the result as,
    26-DEC-13     thursday      52
    27-DEC-13     friday      52
    28-DEC-13     saturday      52
    29-DEC-13     sunday      01
    30-DEC-13     monday      01
    31-DEC-13     tuesday      01
    01-JAN-14     wednesday     01
    02-JAN-14     thursday      01
    for dates 29 ,30,31st it should give 53 .. how can i achieve that using this this query .. can any one help me out on this please...
    thanks,
    pradeep

    I tried with the IW ...
    it is giving week_id for the year.
    select
    mydate,
    to_char(mydate,'day'),
    case when mydate between trunc(mydate,'yyyy') and next_day(trunc(mydate,'yyyy'),'saturday')
    then to_number(to_char(mydate,'yyyy')||to_char(trunc(mydate,'yyyy'),'iw'))
    when mydate between next_day(trunc(mydate,'yyyy'),'saturday') and trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d')-1
    then to_number(to_char(mydate,'yyyy')||to_char(next_day(mydate,'sunday'),'iw'))
    when mydate between trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d') and add_months(trunc(mydate,'yyyy'),12)-1
    then to_number(to_char(mydate,'yyyy')||to_char(trunc(add_months(trunc(mydate,'yyyy'),12)-1,'d')-1,'iw')+1) end as WEEK_ID
    FROM ( SELECT TRUNC (SYSDATE, 'yy') - 1 + LEVEL AS mydate
    FROM dual
    CONNECT BY LEVEL <= (SELECT TRUNC (ADD_MONTHS (SYSDATE, 24), 'yy')
    - TRUNC (SYSDATE, 'yy')
    FROM DUAL
    ))

  • How to parse the year from a date.

    Hi,
    I have the following date format in database.
    05-SEP-07
    18-OCT-07
    18-OCT-07
    25-JUL-07
    18-OCT-07
    What I am trying to do is get only the full year from the date, example
    2007
    2008
    2009
    I tried to use extract function but that doesn't work due to ORA-01843: not a valid month.
    Thanks in advance.
    select extract(year from date '18-OCT-07') from dual;

    OK. You got an error using date literal. Did you at least look in documentation on date literals? I guess not, otherwise you'd see that data literal synatx is DATE 'YYYY-MM-DD':
    SQL> select extract(year from date '18-OCT-07') from dual;
    select extract(year from date '18-OCT-07') from dual
    ERROR at line 1:
    ORA-01843: not a valid month
    SQL>
    SQL> select extract(year from date '2007-10-18') from dual;
    EXTRACT(YEARFROMDATE'2007-10-18')
                                 2007
    SQL> SY.
    P.S. "I have the following date format in database" is completely wrong dates are always stored in one format - internal date format that stores year, month, day, hour, minute and second. When you select date using client tools like SQL*Plus, SQL Developer, Toad, etc. date is converted to string using either explicit or implicit format where you specify which parts of date you want to see.

  • 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 calculate total number of pages in a script

    hi
    how to calculate total number of pages in a script

    Jyothsna,
    Date:-&sy-datum&
    Time:-&sy-timlo&
    Total No.of Pages:-&sapscript-formpages&
    Page No:-&PAGE&/&SAPSCRIPT-FORMPAGES&
    Give the above said lines in your text editor,and given the paragraph format.Better create one more window and give the above said lines in the text editor.
    K.Kiran.

  • How to generate BP number for the employee (ECC to CRM) ...

    Hi all,
    can any one give solution for ,how to generate BP number for the employee from ECC to CRM other than active status,as i downloaded employee data from ECC to CRM through ALE/IDOC,as only active employment status employees are got BP number generated,remaining also transfered to CRM but BP number is not generated for those employees,these employee records i can able to see in the HRP5580- HRP5587 tables.
    thanks in advance.
    vamshi.
    Message was edited by:
            vamshidher rao

    Hi,
    Or are you looking for this:
    SELECT serial_number, paaf.assignment_number
    FROM pay_assignment_actions paa, per_all_assignments_f paaf
    WHERE action_status = 'C'
    AND paaf.assignment_id = paa.assignment_id
    AND serial_number IS NOT NULL
    AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date;
    - Viky
    Edited by: Viky on Dec 17, 2010 11:42 AM

  • How to display week number in a report

    Hi,
    I need to show the week number in a report and related sales data for that week. For example, starting from 01-JUL-2009 the week1 should show total of sales from 01-JUL-08-JUL.
    Help please....
    Thanks
    A/A

    If you are trying to extract the week number of the calender year...you can use..
    sql> select to_char(sysdate,'WW') from dual;
    TO
    05and then group the sales figures by week...
    sql> create table t(
      2     target_date date,
      3     sales       number);
    Table created.
    sql> begin
      2     for i in 1..30 loop
      3        insert into t values (sysdate-i,100*i);
      4     end loop;
      5   commit;
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    sql> select week, sum(sales) from (
      2     select sales, to_char(target_date,'WW') week from t)
      3   group by week;
    WE SUM(SALES)
    05       2100
    02      16800
    01       8800
    04       7000
    03      11900However, if your week calculation starts with a particular date like a calender year starting with 01-june-2010, then you would need to calculate the (relative) week number using something like...
      1  select target_date,
      2         trunc(((target_date - to_date('01-june-2010','DD-MON-YYYY'))/7)) week_number
      3*   from t
    sql> /In the above code, 01-june-2010 is the date from which my calender year starts.
    Please note that since this is relative, you might get negative numbers for weeks.

  • Week Number of the current week...URGENT

    hi gurus,
    I want to calculate the week number of the current week as per Fiscal year.
    What variable or the Customer Exit code needs to be written for it?
    regards

    Hi Venu,
       Use the code below. I assume that the client is US based where the Fiscal Year starts 1st October every year.  Just in case the fiscal year starts in some other month then adjust the code (if SY-DATUM+4(2) >= 10.) below. Hope this helps.
    DATA: PFY(8)   TYPE C.
    DATA: CFY(4)   TYPE C.
    DATA: LFY      TYPE I.
    DATA: FYD      TYPE I.
    DATA: TWD      TYPE I.
    DATA: RES      TYPE I.
    if SY-DATUM+4(2) >= 10.
      concatenate SY-DATUM+0(6)
                  '01'
             into PFY.
    else.
      LFY = SY-DATUM+0(4).
      LFY = LFY - 1.
      CFY = LFY.
      concatenate CFY
                  SY-DATUM+4(2)
                  '01'
             into PFY. 
    endif.
    FYD = P_FY.
    TWD = SY-DATUM.
    RES = ( TWD - FYD ) / 7.
    Write: Res.

  • How to get row number of selected entry from OVS search result

    Hi,
    Anyone having any idea on how to get row number of the  selected entry/ how to differentiate rows in OVS search result in ON_OVS method?
    Regards,
    Jatin

    Hi,
    You can get the selected record to <ls_selection> structure in co phase 3.
    From that structure you can get what ever field you want.,
    check the below code for reference,
    << Moderator message - Cut and paste response from F4 help for ALV table field removed. Plagiarism is not allowed in SCN >>
    hope this helps u.,
    Thanks & Regards,
    Kiran
    Edited by: Rob Burbank on Jan 5, 2012 5:24 PM

  • Generating 52 weeks number of a year associated to a date

    hi
    I try to generate the 52 weeks number of a year associated to the date of the first monday of the week
    For example 1 (week number 1) would be associated to the first monday on the first week of the year.
    Week 2 associated to the secondth week of the year, adn so on. The result would be to columns :
    Number of the wee and its corresponding date of the monday :
    Number_of_the_week----DATE
    1----------------------------01/01/2008
    2----------------------------14/01/2008
    ...... etc....
    52---------------------------29/12/2008
    The request should be something including the year in a "select .(something)... from dual"
    Could you suggest me something ?
    Thank you for your kind answers !Christian

    Christian from France wrote:
    It is not so bad except that each date falls on the tuesday instead of the monday of the week. Hmmm, I don't remember you specifying that in your initial requirements.
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 2009 as yr from dual)
      2      ,off as (select to_number(to_char(trunc(to_date(yr,'YYYY'),'YYYY'),'D'))-1 as offset from t)
      3  select rownum as week, trunc(to_date(t.yr,'YYYY'),'YYYY')+((rownum-1)*7)-decode(rownum,1,0,off.offset) as dt
      4  from t, off
      5* connect by rownum <= 53
    SQL> /
          WEEK DT
             1 01-JAN-09
             2 05-JAN-09
             3 12-JAN-09
             4 19-JAN-09
             5 26-JAN-09
             6 02-FEB-09
             7 09-FEB-09
             8 16-FEB-09
             9 23-FEB-09
            10 02-MAR-09
            11 09-MAR-09
            12 16-MAR-09
            13 23-MAR-09
            14 30-MAR-09
            15 06-APR-09
            16 13-APR-09
            17 20-APR-09
            18 27-APR-09
            19 04-MAY-09
            20 11-MAY-09
            21 18-MAY-09
            22 25-MAY-09
            23 01-JUN-09
            24 08-JUN-09
            25 15-JUN-09
            26 22-JUN-09
            27 29-JUN-09
            28 06-JUL-09
            29 13-JUL-09
            30 20-JUL-09
            31 27-JUL-09
            32 03-AUG-09
            33 10-AUG-09
            34 17-AUG-09
            35 24-AUG-09
            36 31-AUG-09
            37 07-SEP-09
            38 14-SEP-09
            39 21-SEP-09
            40 28-SEP-09
            41 05-OCT-09
            42 12-OCT-09
            43 19-OCT-09
            44 26-OCT-09
            45 02-NOV-09
            46 09-NOV-09
            47 16-NOV-09
            48 23-NOV-09
            49 30-NOV-09
            50 07-DEC-09
            51 14-DEC-09
            52 21-DEC-09
            53 28-DEC-09
    53 rows selected.
    SQL>

  • How to hide page number in the table of content

    Hi,
    I'd like to know how to hide page number in the ToC. They show automatically, but at least for the headings of third ad fourth order I'd like to suppress/omit them.
    Thanks for any advice!

    You have in the Inpspector > Document tab > TOC > uncheck button for #'s

  • How to get name of the month from current date.

    Hi,
       How to get the name of the month from current date.
    Thanks,
    Senthil

    Sethil,
    Use your date(let us say Date1) instead of sy-datum.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    TABLES
    MONTH_NAMES = itab_month
    EXCEPTIONS
    MONTH_NAMES_NOT_FOUND = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE itab_month
    WITH KEY MNR = date1+4(2).
    itab_month-LTX will contain the value you are looking for
    Good luck
    Raghava

Maybe you are looking for

  • How can i send multiple videos and photos, via mail, at the same time?

    you allowed to send only one video or 10(+) photos via mail. but can you send both at the same time? so 10(+) photos and a video (or more than one) in one mail? because if my mom has birthday pictures or something like that. She likes to be able to s

  • CAN I USE TWO IPODS ON THE SAME COMPUTER? PLS help

    i cant seem to find alot of info about this on here... i am probably looking in the wrong place... but heres my situation. Ive had an ipod mini for 2 years now but ive just bought an ipod nano ..... i do all of my main downloading on my power mac g4,

  • Lightroom 5 With Lightroom Creative Cloud?

    I have Lightroom 5 installed on my computer.  If I purchase a Creative Cloud version does that mean I will have two copies of Lightroom on my computer?  Can they share the same library at the same time?  If I later decide to end my Creative Cloud con

  • Missing Memo Pad Icon

    After updating to device software 4.5 I no longer have the Memo icon?  Any idea how to get it back?

  • Source Table not Partitioned, But destination is, Will Streams Work?

    I want to use Oracle streams to setup replication in a single source environment. Here is what I need to do: I have a sorce data base where tables are not partitioned and oits an OLTP system. I have another DB which has same schema as OLTP, but some