Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change date format in XSLT 3

Status
Not open for further replies.

abs2003

MIS
Aug 31, 2004
80
US
Hi all,

How can format my date as mm/dd/yyyy in XSLT?
My SQL Server's datetime field contains "5/3/2005 2:48:41 PM".
My XSLT code
Code:
<xsl:value-of select="StartDate"/>
. My output: "2005-05-03T14:48:41.0000000-04:00" which looks weird.

Help please,

abs
 
assuming you are using for xml explicit within your sql to create the xml why not just convert on the sql server ?

convert(varchar(10),dStartDate,103)



?



 
Or use:
Code:
<xsl:value-of select="concat(substring(StartDate,6,2),'/',substring(StartDate,9,2),'/',substring(StartDate,1,4))"/>

Jon

"There are 10 types of people in the world... those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top