Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have SharePoint 2010 calendar and I am opening it as DataFormwebpart in SharePoint Designer and I noticed EndDate as follows: xsl:value-of select="@EndDate"/ and the result is 2012-03-15T14:30:00Z

How can I modify the xsl:value-of select="@EndDate"/ to Show DateTime as follows 2012-03-15 9:30 AM

Thanks,

share|improve this question
add comment

1 Answer 1

You'd have to parse the value with XSL and XPath. Check out these links, they should get you started:

XSL if: http://www.w3schools.com/xsl/xsl_if.asp

XPath transform(): http://www.w3schools.com/xpath/xpath_functions.asp

And some related SE posts:
http://stackoverflow.com/questions/268116/how-can-i-do-string-operations-in-xslt
http://stackoverflow.com/questions/1569523/can-an-xslt-parse-a-string-of-text

Hope that helps.

share|improve this answer
    
I can get the desired result with the following but just missing the time part, I want 9:00 AM instead of 14:00<xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDateTime(string(@EventDate), 2057, 'yyyy/MM/dd HH:mm')" /> result is 12/03/2012 14:00 –  4uSharePoint Mar 15 '12 at 15:44
    
    
Try and use 1033 instead of 2057, since AM/PM probably is not used in your location (2057) it will not parse it with AM/PM. –  Anders Aune Mar 15 '12 at 16:31
    
Try using this format string: 'yyyy/MM/dd hh:mm P' HH = hours (24 hour clock) hh = hours (12 hour clock) P = AM/PM marker Ref: w3.org/TR/xslt20/#function-format-dateTime (see section 16.5.1) –  Wade Henderson Mar 15 '12 at 18:30
    
Thanks guys, the following is working, but AM/PM part is not working even I added P in the end but no luck. Can you plz let me know any alternative. select="ddwrt:FormatDateTime(string(@EventDate), 2057, 'yyyy/MM/dd HH:mm')" result is 12/03/2012 02:00 –  4uSharePoint Mar 16 '12 at 17:53
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.