Formatting a date in XSLT

I am working with an XSLT fragment in dreamweaver and all
seems to be working fine except when it comes to the date field in
the XML it is transforming. It looks like dreamweaver has no
options in it for formatting a date. Looking on the web it appears
that XSLT doesn't have a function for that except if you are
running XSLT 2.0??
my XML looks like
<pubDate>Wed, 04 Apr 2007 04:00:00
+0100</pubDate>
Can anyone help me just show only this part, "Wed, 04 Apr
2007"
thanks
chris

>I am working with an XSLT fragment in dreamweaver and all
seems to be
>working
> fine except when it comes to the date field in the XML
it is transforming.
> It
> looks like dreamweaver has no options in it for
formatting a date. Looking
> on
> the web it appears that XSLT doesn't have a function for
that except if
> you are
> running XSLT 2.0??
Correct.
> my XML looks like
> <pubDate>Wed, 04 Apr 2007 04:00:00
+0100</pubDate>
> Can anyone help me just show only this part, "Wed, 04
Apr 2007"
With XSLT, this should work:
<xsl:value-of select="substring(pubDate,1,16)"
order="descending" />
The substring function variables are:
substring(node, postition of start character in string, total
number of
characters to include)
It's akin to a TRIM string statement in server-side
programming languages.
-Darrel

Similar Messages

  • Current Date in XSLT 1.0 Mapping

    Hi All,
    Very Good Morning...
    I have one issue my XSLT mapping, One filed is required current date and time.But in XSLT 1.0 there is no standard date function. But XSLT 2.0 version is aviable.
    I am using the XSLT1.0 version.i saw in SDN some threads are related to this issue. XSLT supported for Java extensions.
    Upto now i am n't working with JAVA mapping. How i can create a JAVA extension and how i can import to Integration Respoistery....
    Kindly give me suggestion about this issue.
    Thank you very much.
    Sateesh

    Dear Sateesh,
    Declare xlst variables at start of xsl program like below
                             <xsl:output method="xml" indent="yes"/>
         <xsl:variable name="today_formatted" select="java:java.text.SimpleDateFormat.new('yyyyMMdd')"/>
         <xsl:variable name="time_formatted" select="java:java.text.SimpleDateFormat.new('HHmmss')"/>
          and use them in xsl mapping
    <xsl:value-of select="substring(concat(java:format($today_formatted, $date),$blanks),1,8)"/>
    <xsl:value-of select="substring(concat(java:format($time_formatted, $date),$blanks),1,6)"/>
    thanks,
    madhu

  • How to compare date in xslt

    hi
    i need to compare the date in xslt . i was not able to get the current date in xslt.. so i entered through parameter by java. now i have the current date and in xml i have two field fromdate and todate i need to compare that some data should display when current date comes between fromdate and todate. can u tell me how to do it .
    try to provide some code....
    i was looking for some format date function but could get it
    xsl:if test="data/fromdate > currdate and date/todate < currdate"
    it is not working becouse i am not able to convert my varriable to date type... may be
    please help
    anagh

    Hi,
    I am running into a same problem with xsl :-
    a) I need to generate the current date and store it in a field
    b) I have a date field with a End date entered by the user..
    I need the xslt to minus the current date from the enddate and show the number of days / weeks left.
    How can i do this ?
    Rgds,
    Manoj

  • How to compare to date and From date in XSLT

    Hi,
    I have to check in my process "*To date*" and "*From date*" and make "*To date*" greater than or equlas to "*From date*"..
    Is there any function which performs this task.
    I will appreciate if someone can provide any Solution on the same..
    Thanks in advance..

    Hi,
    You can compare dates in XSLT as in BPEL and in XPath using &lt; and > and =, you can even add a duration in days or months to your date using xp20:add-dayTimeDuration-to-dateTime()
    The only but is all the dates have to be in ISO 8601 Format...
    http://www.w3.org/TR/NOTE-datetime
    For example:
    *1994-11-05T08:15:30-05:00* corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time.
    *1994-11-05T13:15:30Z* corresponds to the same instant.
    The following will return true if $dateFrom is less than $dateTo...
    <xsl:value-of select="$dateFrom &lt; $dateTo"/>Cheers,
    Vlad

  • Print a report on doc format truncate data

    hi
    I have a report launching with a form in an oracle applications, when I print a report on pdf format looks ok
    but when I print the same report on doc format truncate data on left and right side.
    Can you help me
    thanks

    Hi Herbe
    Reports does not support .doc format. Are you referring .rtf format?
    In any case, you must contact Oracle Support to get the issue resolved.
    Regards
    Sripathy

  • How to format a date to display the ISO week number in BI Publisher ?

    Hi there,
    I need to format a date to display the ISO week number in BI Publisher.
    I've tried the following <?format-date:NEED_BY_DATE;'WW'?>, but it returns a week number (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year, which is not what I want.
    I want the ISO week number (1-52 or 1-53), the one implemented by the 'IW' format mask of the Oracle PL/SQL TO_CHAR() function for example.
    I've tried using 'IW' format mask, but it is not recognised by BI Publisher.
    Also, as I'm working on an RTF template, I've tried 'IW' as MS Word date format, but it is not recognised by MS Word :-((
    Any help would be much appreciated,
    Regards - Hugues

    Hi,
    Thank you for the post.
    The thing is I don't have access to the query, unless I modify a standard E-Businees Suite view (one of those used to generate the PO document in Purchasing).
    Regards - Hugues

  • Formatting of data --- in SQLPlusw

    When I issue the following statement to SQLPLUSW
    select * from V$database;
    Hard to read the results on the screen.
    How to format this data so that I can read it very easily?
    Thank you,
    Smith

    user517525 wrote:
    When I issue the following statement to SQLPLUSW
    select * from V$database;
    Hard to read the results on the screen.
    How to format this data so that I can read it very easily?
    Thank you,
    SmithGo to tahiti.oracle.com. Drill down to your product and version. There you will find the complete doc library. It includes a very fine SQL*Plus Reference Manual.
    Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.

  • Format of Date field is loading wrongly in the Infocube 0pp_c01.

    Hi,
    Format of Date field is loading wrongly in the Infocube 0pp_c01. But it is loading properly into PSA.
    I am loading data into PP infocubes from the following DataSources.(they all are 3.x datasources)
    1. 2LIS_04_P_MATNR
    2. 2LIS_04_P_ARBPL
    3. 2LIS_04_P_COMP
    The data is coming properly upto PSA.  For example Actual Start date is loaded in cube like 733.884.
    And, it is the same issue with all the cubes. So I checked the update rules. But, in it the mapping is done properly.
    Thanks $ Regards
    Shyne Sasimohanan
    +91-9632674245

    Hi,
    HEre also value is loaded correctly. The reason u are seeing it in this format is because it is mapped into a key figure in the info cube.
    It will store the value as number of days from a standard date like 1/1/1000 or 1/1/1900 - not sure which one of these, u should be able to search and find the correct date in the forums..but this is the logic behind it
    Hope it helps.
    Regards,
    Rathy

  • Format of date and numbers

    Hi,
    in Italy the format of date is DD/MM/YYYY e the formato of numbers is NNN,DD (DD means Decimal).
    I use Excel for IPAD but when I write for instance 28/03/2015 the field shows 03/28/2015, the same problem is for numbers where the comma and the dot are inverted.
    How do I change the format of date and numbers?
    Thank you in advance.
    Max

    The general format of the date is tied to the language...use US english, get US date formatting.
    You may want to poke around in excel's settings. I know the desktop version allows you to alter the date formatting, but I'm not sure if the iPad app has that. Look for 'cell formatting' in the settings and see if it's alterable.
    If not, you can try to make your template on a PC, then put that excel onto your iPad and see if it honors the cell formatting already in place.

  • Convert String to Date and Format the Date Expression in SSRS

    Hi,
    I have a parameter used to select a month and year  string that looks like:    jun-2013
    I can convert it to a date, but what I want to do is,  when a user selects a particular month-year  (let's say "jun-2013")
    I  populate one text box with the date the user selected , and (the challenge Im having is)  I want to populate a text box next to the first text box with the month-year  2 months ahead.    So if the user selects 
    jun-2013   textbox A will show  jun-2013 
    and textbox B will show  aug-2013..
    I have tried:
    =Format(Format(CDate(Parameters!month.Value  ),  
    "MM-YYYY"  )+ 2  )   -- But this gives an error
    This returns the month in number format   like "8"    for august...
    =Format(Format(CDate(Parameters!month.Value  ), 
    "MM"  )+ 2  )
    What is the proper syntax to give me the result    in this format =  "aug-2013"  ???
    Thanks in advance.
    MC
    M Collier

    You can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
    In your case, the code would be something like:
    var sDate = "2013-01-10";
    // Convert string to date
    var oDate = util.scand("yyyy-mm-dd", sDate);
    // Convert date to new string
    var sDate2 = util.printd("mm/dd/yyyy", oDate);
    // Set a field value
    getField("date2").value = sDate2;
    The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started.

  • Need help in formatting the Date - Date does not

    Need help in formatting the Date - Date does not formats and give Not a valid month error in the below scenario.
    select oc.ST_PGM_MGR, r.ag_dnum, get_major_work_type(r.perf_eval_rtng_id) "v_work_code", r.ag_dnum_supp "supp", r.intfinal, to_char(r.formdate,'MM/DD/YYYY') "formdate", to_char(r.servfrom,'MM/DD/YYYY') "srv_from", to_char(r.servto,'MM/DD/YYYY') "srv_to", descript, add_months(to_char
    --- Bellow line of Code on trying to format it to mm/dd/yyyy gives the error
    (r.formdate, 'DD-MON-YYYY'),12) "formdate2"
    from  table REdited by: Lucy Discover on Jul 7, 2011 11:34 AM
    Edited by: Lucy Discover on Jul 7, 2011 1:05 PM

    Your syntax is wrong - look at the post above where this syntax is given:
    to_char (add_months(r.formdate,12), 'MM/DD/YYYY') "formdate2"Look at the formula from a logical perspective - "inside out" to read what is happening -
    take formdate, add 12 months
    add_months(r.formdate, 12)then apply the to_char format mask - basic syntax
    to_char(date, 'MM/DD/YYYY')Compare to your syntax:
    to_char(add_months(r.formdate, 'MM/DD/YYYY'),12) "formdate2"You will see your format string inside the call to add_months, and your 12 inside the call to to_char.
    Good luck!

  • I need format for data in excel file load into info cube to planning area.

    Hi gurus,
    I need format for data in excel file load into info cube to planning area.
    can you send me what should i maintain header
    i have knowledge on like
    plant,location,customer,product,history qty,calander
    100,delhi,suresh,nokia,250,2011211
    if it is  right or wrong can u explain  and send me about excel file format.
    babu

    Hi Babu,
    The file format should be same as you want to upload. The sequence of File format should be same communication structure.
    Like,
    Initial columns with Characteristics (ex: plant,location,customer,product)
    date column (check for data format) (ex: calander)
    Last columsn with Key figures (history qty)
    Hope this helps.
    Regards,
    Nawanit

  • MS Word Web Service Interface: bad format of date and currency fields

    Hi,
    I am using MS Word Web Service interface to create contract documents. However, my date and currency fields show in a strange format. Date is in"YYYY-MM-DD" format, while currencies always have "." as decimal separator (probably technical values). My user settings are "DD.MM.YYYY" for dates and "n.nnn,dd" for decimal numbers.
    My workaround is to create a Z structure for WS interface with char fields and then do conversion through CRM_WST_RT_BADI->OUTBOUND_PROCESSING method. This works, but requires a lot of custom development.
    Is there a way to "tell" the interface to use correct formats in MS Word without doing it all manually through custom fields?
    Thanks!
    KR,
    Igor

    Oh, indeed!
    We might be closer than you think - I live close to Croatian-Slovenian border so we might pop out for a drink! But we can discuss this out of forum... 
    Now work again:
    Is there any documentation on possible formatting keywords? I suppose it's possible to set up decimal places, custom date formats etc.
    Cheers,
    Igor

  • Formatting  a Date

    Hi, Can someone tell me how to simply format the date to this:
    MON DD, YYYY
    Thanks

    You can use the SimpleDateFormat like:
    java.text.DateFormat df = new java.text.SimpleDateFormat(format);where formar is a String like:
    format= "dd/MM/yyyy";for a date like "07/06/2003"
    You can use any format you want modifying the format using the following symbols:
    Symbol Meaning Presentation Example
    G era designator (Text) AD
    y year (Number) 1996
    M month in year (Text & Number) July & 07
    d day in month (Number) 10
    h hour in am/pm (1~12) (Number) 12
    H hour in day (0~23) (Number) 0
    m minute in hour (Number) 30
    s second in minute (Number) 55
    S millisecond (Number) 978
    E day in week (Text) Tuesday
    D day in year (Number) 189
    F day of week in month (Number) 2 (2nd Wed in July)
    w week in year (Number) 27
    W week in month (Number) 2
    a am/pm marker (Text) PM
    k hour in day (1~24) (Number) 24
    K hour in am/pm (0~11) (Number) 0
    z time zone (Text) Pacific Standard Time
    ' escape for text (Delimiter)
    '' single quote (Literal) '
    Juan Carlos

  • Formatting a date that is inserted into a text object

    The on-line documentation for inserting a date into a form letter instructs a user to insert a Print Date into a text object.  To format the date, the user is instructed to double-click on the date object and then right click and select Format {Print Date} from the menu.
    This works when using Crystal Reports 2008 without any service packs.
    However, after installing SP1, this feature no longer works.  The Format {Print Date} is grayed out and not available for selection.
    I am using VISTA Enterprise.
    Are there any reasonable reasons why this functionality was removed with SP1.

    You have a brilliant work around.  Thanks!
    However, it is still a work around.
    I hope someone within the Crystal Reports organization sees this post and either provides an explaination as to why SP1 does not allow you to directly edit a field or that someone realizes that this is a bug and starts the process of providing a fix.
    By the way, I duplicated the problem on both VISTA and XP machines.

Maybe you are looking for

  • Blocked plug-in sign on safari after trying repeatedly to download new version of flash

    downloaded the new flash, and now it wont work on safari. Never had a problem with it before. I tried installing the unistaller but can't find it in downloads( I made sure that downloads went to the download folder). i tried all the other links for d

  • Material Classification (Level Wise)

    Dear Experts, We want to Classify our Material like below: Level-1:      Direct / Indirect Level-2:     Raw material / packaging / consumables / Proffesional Services / Transport etc. Level-3:     Iron          /             Eletrical           /   

  • Mass Change in Recipe Management

    Is anyone doing non-status related mass changes in RM?  Specifically, is anyone substituting substance X for substance Y in dependent formulas inside recipes?  If so, was the related work in-house ABAP development or SAP CDP?  Any helpful hints would

  • Load balancing OIF

    I have two servers running two different OIF instances (http://oif1.domain.com:7777, http://oif2.domain.com:7777) We have a F5 load balancing with url (https://f5oif.domain.com) balancing the above urls How do I load balance these oif instances. They

  • Ressurecting an old laptop

    Hey guys, my HP dv6000 laptop has been having major hardware issues lately (stay away from HP laptops) and is out of commission for the time being so I dug out my old gateway.  I'm trying to make it as functional as possible with its limited resource