Transform date from dd-mon-yy to yyyy-mm-dd

Hi
I have a simple date transformation question.
my input date format is DD-MON-YY, I want this converted to YYYY-MM-DD
I did look into the xp20:format-dateTime and ora:formatDate but did not find a way
to control the input format. I did test the transformation below, and this one gives the expected output, as
long as the input is xp20:current-dateTime().
<xsl:value-of select="xp20:format-dateTime(xp20:current-dateTime(),'[Y0001]-[M01]-[D01]')"/>
How do I switch the date format to handle DD-MON-YY as input.
To be specific:
when ns:myDate=01-Aug-08' I would expect outcome as below,
<xsl:value-of select="xp20:format-dateTime(ns:myDate,'[Y0001]-[M01]-[D01]')"/> => 2008-08-01
but this is clearly not so.
any idea on how to do this, without starting a full substring-implementation?
according to this thread, it looks like we need to leave this to java, but I believe it must be possible to
handle this within xslt-transformation.
On the other hand, dd-mon-yy is not ISO, and four digit year would be unambiguous .
anyway:
Re: BPEL format Date issue

I understand its frustrating to not get a solution from the xslt which is a strong language in itself. I have faced the same problem, but i got a way to do in xslt using templates.
If anybody is interested here is the solution.
My input value is for eg. '1-May-12'
Output value should be in ISO format '2012-05-01T00:00:00.000'
+<xsl:template name="formatDateTime">+
+<xsl:param name="DateTime"/>+
+<xsl:value-of select="concat('20',substring-after(substring($DateTime,oraext:last-index-within-string($DateTime,'-')),'-'))"/>+
+<xsl:text>-</xsl:text>+
+<xsl:choose>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Jan'">+
+<xsl:text>01</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Feb'">+
+<xsl:text>02</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Mar'">+
+<xsl:text>03</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Apr'">+
+<xsl:text>04</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='May'">+
+<xsl:text>05</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Jun'">+
+<xsl:text>06</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='July'">+
+<xsl:text>07</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Aug'">+
+<xsl:text>08</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Sep'">+
+<xsl:text>09</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Oct'">+
+<xsl:text>10</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Nov'">+
+<xsl:text>11</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Dec'">+
+<xsl:text>12</xsl:text>+
+</xsl:when>+
+</xsl:choose>+
+<xsl:text>-</xsl:text>+
+<xsl:choose>+
+<xsl:when test="string-length(substring-before($DateTime,'-')) = 1">+
+<xsl:value-of select="concat('0',substring-before($DateTime,'-'))"/>+
+</xsl:when>+
+<xsl:otherwise>+
+<xsl:value-of select="substring-before($DateTime,'-')"/>+
+</xsl:otherwise>+
+</xsl:choose>+
+<xsl:text>T00:00:00.000<;/xsl:text>+
+</xsl:template>+
You can call this template on the element you want to use in the main template.
+<xsl:call-template name="formatDateTime">+
+<xsl:with-param name="DateTime" select=${your xpath}>+
+</xsl:call-template>+
Hope it helps.
Regards
Ayush

Similar Messages

  • Function module to change Date from YYYYMMDD to DD.MM.YYYY

    Hi
    PLease tell me the function module that will convert date from YYYYMMDD to DD.MM.YYYY
    Thanks

    Hi,
    data lv_date1 type sy-datum.
    data lv_date2(12).
    lv_date1 = '20070123'.
    concatenate lv_date16(2) lv_date14(2) lv_date1+0(4) into lv_date2
    separated by '.' .
    is what you require to do;
    now lv_date2 = 23.01.2007.
    Also look for conversion routine "CONVERSION_EXIT_PDATE_OUTPUT"
    EG: call function CONVERSION_EXIT_PDATE_OUTPUT
                             exporting input = lv_date1
                             importing output = lv_date2.
    Thanks,
    Anitha

  • Transform data from multiple sources to single target in bpel 10.13.1.0

    Hi,
    I need to transform data from mulitple sources to single target schema.
    Please any one can give some idea.
    Regards
    janardhan

    We are gone a other way merge multiple information into one target.
    First we have created a wrapper variable with the structure of the target variable that we want use in the transformation.
    With a assign element we filled the wrapper variable with information from the inputvariable of the bpel process and some addtional information.
    Then we called in the transformation the wrapper variable as source and the target variable as target.
    We have used that way in some bpel process and it works for us.
    Within Oracle SOA Suite 11g, there is the mediator component that does simply routing
    and transformation functionality within a composite (SCA).
    That's all, I hope that help.
    Michael

  • How to convert date from "yyyymmdd" to "MM/DD/YYYY" format

    1. I have one BLDAT field in my internal table.
       its getting updated from input file.
    2. The value in the input file is like yyyymmdd.
       So the internal table field is filled like this
       "YYYYMMDD".
    3. After this,I have to compare this internal table  
       field with BSAD table.
    4. The BLDAT field in BSAD table is in the format of 
       "MM/DD/YYYY".
    5. the BLDAT field is having diff format in internal  table and BSAD table.So I am unable to check this value.
    How to convert it as like the BSAD table format."MM/DD/YYYY" format.
    Thanks in advance!!

    Using the WRITE statement
      data: gd_date(10).  "field to store output date
    * Converts date from 20020901 to 09.01.2002
      write sy-datum to gd_date mm/dd/yyyy.
    OR u can
    CONCATENATE gd_date+4(2) gd_date+6(2) gd_date+0(4)
    into gd_date seperated by '/' .
    Hope this helps.
    Kindly reward points and close the thread for the
    answer which helped u OR get back with queries.

  • How to plot VS time after transforming data from Dynamic to array ?

    Hi ! 
    I am currently using a DAQ Assistant to get dynamic data from 2 channels input.
    With a splitting VI, I substract one to the other and plot them ( Graphic named 1 )
    Then I use a VI which transform the Dynamic result of the soustraction into an array, in order to calculate its mean.
    After that step, when I turn my script ON, I am well capable to observe dynamically my mean evolve from an indicator
    BUT
    I can not observe it plotted VS time as I would like.
    In other words, from the dynamic data I have value VS time, I get the mean of it over time, and I would like to be able to plot it back VS time, with the previous mean points plotted.
    All I can get now is a single point moving up and down, because it is lacking time data.
    I attached to this post a simple represenation of my issue, I hope I provide enough information.
    I just would like to be able to plot like the window on the left, and not having the one on the right ...
    Thank you !

    Hi ! 
    Thank you for your quick answer.
    I see what you mean, it makes sense.
    But how will I be able to plot the mean VS time if now I have all my data splited into arrays ? 
    I am not sure I talk clearly ... In other ords how will I rebind that mean and Time into one wire to send it into graph VI ?

  • How to transform data from hierarchy table to taxonomy table?

    Hi Friends
    Regarding my issue:
    1) I am having data in the hierarchy table which contains two fields(i.e. code, description) , now we have created another taxonomy table which contains two fields(i.e. code,description) same as hierarchy table.
    2) hierarchy table only contains data, which we have imported data into hierarchy table using import manager. we don't have data in the taxonomy table.
    3) now my issue is,we have to move that hierachical data in the hierarchy table to taxonomy without using import manager, only through the data manager using validations and assignments.
    4) If any one have solution to this issue, please help me out.
    Thanks in Advance
    bharat.chinthapatla

    Hi Ganesh,
    Thanks for your reply,
    I need to move data from hierarchy table to taxonomy table using validations and assignments.
    Thanks in Advance
    bharat.chinthapatla

  • How to transformed data from File to DB but the data to be insert two tables  parallel?

    Hi friends ,I am new to Oracle SOA ,I have one requirement  for the project
    actually in these project
    1.I have to read three different types of files (Employee info,Purchase Order Info,Salaes Order Info) through file adapter these records are to be store in  data base 
    transaction table.In these transaction table contains WHO columns and payload  with clob data type which contains each  record  in xml form.
    2. Now I have to  take these payload data  which is in xml form and store   in the respective table(employee or PO or SO) .I have to call these in dynamically.
    so please give me ideas and suggesstions ,,
    thanks in advance

    Roger,
    I don't know about simple way to load data from file into a table using button from your application,
    Maybe some piece of PL/SQL code with UTL_FILE or DBMS_LOB, or you can try to upload file to database using Apex "File browse" item, and then do some processing with DBMS_LOB... but it will require some work...
    Maybe someone else could advice with some simple method I don't know...
    However loading files using Apex Load Utility is quite easy.
    You can use something like this to load data to views created on remote tables:
    CREATE TABLE local_tmp_table AS SELECT * FROM view_on_remote_table WHERE 1=0;
    --load data from file to created table using Apex Load utility
    INSERT INTO view_on_remote_table SELECT * FROM local_tmp_table;
    COMMIT;
    DROP local_tmp_table;Or without views:
    CREATE TABLE local_tmp_table AS SELECT * FROM remote_table@dblink WHERE 1=0;
    --load data from file to created table using Apex Load utility
    INSERT INTO remote_table@dblink SELECT * FROM local_tmp_table;
    DROP local_tmp_table;Regards
    Tomasz
    Message was edited by:
    Tomasz K.

  • How do i create an ssis package that transforms data from a text file?

    I have a text file with data that in the following  format; i want this data in columns with the appropriate heading. Any ideas??
    Name – Tony
    Married – 2 children (Girl:3, Boy:1)
    AddressLine1: 10 Sunnhill Ave
    AddressLine2: Streatham
    AddressLine3: London
    PostCode:  SW18 7NN
    Name – Sarah
    Married – 2 children (Girl:3, Boy:1)
    AddressLine1: 10 High St
    AddressLine2: Streatham
    AddressLine3: London
    PostCode:  TW18 7NN
    Name – Tom
    Married – 2 children (Girl:3, Boy:1)
    AddressLine1: 10 Bridge Ave
    AddressLine2: Hammersmith
    AddressLine3: London
    PostCode:  TF20 8HN
    sukai

    I don't see how you're going to pivot that using SSIS.  I happen to know VBA pretty well, and I'll give you this Macro, which should do what you want.
    Sub CombineRows()
    lastRow = Range("A" & Rows.Count).End(xlUp).Row
    'set rowcount to row where you want 1st entry
    RowCount = 1
    NewRow = RowCount
    Start = False
    Do While RowCount <= lastRow
    If Start = False Then
    If Range("A" & RowCount) <> "" Then
    Start = True
    StartRow = RowCount
    End If
    Else
    If Range("A" & (RowCount + 1)) = "" Then
    ColCount = 1
    For MoveRow = StartRow To RowCount
    Cells(NewRow, ColCount) = Cells(MoveRow, "A")
    ColCount = ColCount + 1
    Next MoveRow
    NewRow = NewRow + 1
    Start = False
    End If
    End If
    RowCount = RowCount + 1
    Loop
    Rows(NewRow & ":" & lastRow).Delete
    End Sub
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Migrate data from orcle to oracle

    Hi ,
    A) Using oracle workbench tool can we migrate data from oracle 9i to oracle 10g ?
    B) Is this tool used only for migrating data from non-oracle source to Oracle db ?
    regards
    thiru

    Dear Barry
    Thanks for the valuable information provided, it had answered few of my doubts.
    i am much thankful to you if you can help me in this regards.
    Does Oracle own any GUI based tool similar to Microsoft-DTS to Extract & transform data from one Oracle DB to other Oracle DB ?
    The source DB (oracle 9i) is not properly normalized , the data from source is moved to a Normalized 10g DB with new attributes(based on new requirements) added to these tables . Some tables from source are splitted into 2 or more in target (oracle 10g) database. I have scenarios like
    My text below quotes "SOURCE" AS UNNORMALIZED DB & "TARGET" as new DB which is NORMALIZED.I need to migrate data from SOURCE to TARGET
    1) A single row in SOURCE be migrated to multiple rows across one or more
    tables in TARGET.
    2) A multiple rows in single column in SOURCE be migrated to single row and
    multiple columns in TARGET.
    For the above mentioned scenario sql*loader /external table/export & import or transportable tablespaces can be used as mentioned by you. but considering the ease of use and the complexity is there any GUI tool which oracle has for data migration from oracle db to oracle db.
    your advice will be much help to me.
    Thanks
    Thirumaran

  • Import from database moni

    hi all
    i want to write a report like tcode st03n.
    so , i want to extract data from table moni.
    i have read some information about
    IMPORT <f1> [TO <g1>] <f2> [TO <g2>] ...   FROM DATABASE dbtab <ar>  ID <key>
    i have tried some statement like
    IMPORT xxx  FROM DATABASE moni(DD)
    ID '--TOTAL   H*MONT200808'.
    but, i could not extract the data.
    someone said, the structure of <f1> and the data in table moni  must have the same format to import  
    how can i know the data format in table moni ?

    please refer to the  SAP note 1000275
    i got the same error so i rectified it by changing  fields type of hist2 .
    below declaration of hist2 data is giving error
    data: begin of hist2 occurs 0,
            date like sy-datum,
            time like sy-uzeit,
            size      type p,     "Changed to 'p'
            free      type p,     "Changed to 'p
            used      type i,
            tables    type i,
            indices   type i,
            tsize     type i,
            isize     type i,
          end of hist2.
    error rectified with below hist2 data( tsize and isize type is changed to p)
    data: begin of hist2 occurs 0,
            date like sy-datum,
            time like sy-uzeit,
            size      type p,     "Changed to 'p'
            free      type p,     "Changed to 'p
            used      type i,
            tables    type i,
            indices   type i,
            tsize     type p,
            isize     type P,
          end of hist2.

  • Convert Date format from YYYYMMDD to MM/DD/YYYY --issue with Mapping

    Hi All ,
    I have IDOC(DESADV.DELVRY03-> file ) scenario which i am working on . While debugging noticed that the field :
    E1EDT13\NATNZ -Data Transformation(from yyyymmdd to mm/dd/yyyy)-Target .This works
    But say if IDOC doesn't pass any value (For Good's issue) I get Error during debugging : RuntimeException in Message-Mapping transformation: Unparseable date: ""
    I did check thsi blog : Convertinf Date format from YYYY-MM-DD to MMDDYYYY  but this is  about the Data Transformtaion.
    I tried using constants , create if , -these function doesn't work /not applicle in this case
    Could you please provide  inputs as to how to handle two condition :
    1. With date -- then transform
    2.Else , pass nothing

    Hi Varalakshmi,
    Plese try to use UDF for date conversion and include logic which would check the Space value from the source structure.
    so if there is space return as such
    else.
    perform the conversion logic.
      Convertinf Date format from YYYY-MM-DD to MMDDYYYY
    (The conversion logic has been provided by micheal in the thread you have provided in the query)
    Thanks,
    Ram.

  • Display as Date Picker (DD-MON-YYYY)

    Hi everyone,
    can you please help me:
    I want to change an item as Display as Date Picker (DD.MM.YYYY). I cannot find this mask.
    Can you help me to change or can you tell me, where i could find an example?
    Tahnk you and best regards
    Siegwin

    Note that changing the format of a Date Picker does not change the default database input/output date format. Meaning, the NLS_DATE_FORMAT (the default format used when selecting from, or writing to, the Oracle database) does not change when the date picker is changed.
    The date picker format used should match the date format of the application. Meaning that if you retrieve a date from the database into a text field and it found to be in the YYYY-MM-DD format, then the date picker used should be in the YYYY-MM-DD format and if the date retrieved from the database is in the format DD-MON-RR then the Date Picker used should also be in that format.
    The date picker is there to allow dates to be chosen from a calendar in a particular “text” format.
    So, set your date picker to match your NLS DATE FORMAT setting.
    Now, if you want to change the default input/output date format (which is likely your desired effect), then you want to start looking at the NLS settings in your database, the NLS settings in your DAD (reference Marvel.conf), and the NLS settings as they are affected by your Web browser Regional Settings (i.e. Language, territory). If this is the case, refer to the following postings:
    HTMLDB - HOWTO Work with Dates
    Re: HTMLDB - HOWTO Work with Dates
    HTMLDB - HOWTO Work with Dates
    HTMLDB - HOWTO Work with Dates
    YYYY-MM-DD Format for Canada and ISO
    YYYY-MM-DD Format for Canada and ISO

  • Need regular expression for oracle date format 'DD-MON-YYYY'

    Hi,
    Can anybody tell me the regular expression to validate date in 'DD-MON-YYYY'.
    My concept is i have a table with just two columns item_name and item_date
    Both fields are varchar2 and i want to fetch those records from this table which have valid date format('DD-MON-YYYY').

    If it must be a regexp, this is a starter for you, note it carries the caveats mentioned by both posters above and in the linked thread
    mkr02@ORA11GMK> with data as (select '10-jan-2012' dt from dual
      2  union all select '10-111-2012' from dual
      3  union all select 'mm-jan-2012' from dual
      4  union all select '10-jan-12' from dual)
      5  select
      6  dt,
      7  case when regexp_like(dt,'[[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4}','i') then 1 else 0 end chk
      8  from data
      9  /
    DT                 CHK
    10-jan-2012          1
    10-111-2012          0
    mm-jan-2012          0
    10-jan-12            0It will not validate content, only string format.
    And to emphasis the points made in the linked thread - dates in text columns is poor design. Always.

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Data from two tables in the same row in XML transformation

    Hi,
        I am using XML transformation for generating excel file which is to besent as email attachment.
        Here  I want to display the data from two internal tables in the same row in the excel. .I am using   <tt:loop ref=".<table name>"> ...  </tt:loop> for looping through the table. Can I loop two table simultaneously ? In that case how will I specify the fields in each table . Some of the fields in two tables are of same name and type.
    Please help...
    Thanks,
    Jissa

    Hello Brian,
    Thank you for your answer. It is approach I will use, I think. However let me ask: Would it be possible to have a Version in this layout, too? I mean to see, which value comes from Version A and which comes from Version B? Something like this:
    Calendar Month Version Sales Amount
    2011.01  B  200
    2011.02  B  300
    2011.03  A  260
    2011.04  A  230
    2011.05  A  200
    A

Maybe you are looking for