Blog Archive

Wednesday, May 23, 2012

Converting the Date Time into Date using XSLT

Most of the times when we are modifying web parts then we need to show the date in the MM/DD/YYYY format and in the list column is Date Time. Here we want to remove the Time field and show only the date that too specific format. 

In this case we can use the following XSLT expression to convert the Date Time into Date in MM/DD/YYYY format. Use the following syntax in your select attribute of xsl:value.

ddwrt:FormatDateTime(string(@StartDate),1033,'M/d/yyyy')

Here Start Date is the Date Time Field and it will show only date element in MM/DD/YYYY format.