SharePoint 2010: Format Date Value in Data View Web Part - Xslt

There are various ways to format date values in a SharePoint Data View Web Part using xslt.

To be able to use the FormatDate function, add the DDWRT name space reference in the top section.

xmlns:ddwrt=http://schemas.microsoft.com/WebParts/v2/DataView/runtime
 
In SharePoint Designer Xpath Method Add  FormatDate(Columnname,LCID,FormatFlat) method.

sharepoint Designer Xpath Method

xslt
 
<xsl:value-of select="ddwrt:FormatDate(string(@StartDate), [LCID],[FORMAT FLAG])"/>

Format Flag 

Format Flag Example
1 MM/dd/yyyy. ==> “08/17/2000″
3

dddd, MM dd, yyyy. ==> “Thursday, August 17, 2000″

4

h:mm. ==> “16:32″

5

MM/dd/yyyy h:mm. ==> “08/17/2000 16:32″

7

dddd, MM dd, yyyy h:mm. ==> “Thursday, August 17, 2000 16:32″

12

h:mm:ss. ==> “16:32:32″

13

MM/dd/yyyy h:mm:ss. ==> “08/17/2000 16:32:32″

15

dddd, MMMM dd, yyyy h:mm:ss. ==> “Thursday, August 17, 2000 16:32:32”

 
LCID is a language code
 
Language LCID
Afrikaans 1078 (&H436)
Albanian 1052 (&H41C)
Arabic 1025 (&H401)
Arabic Algeria 5121 (&H1401)
Arabic Bahrain 15361 (&H3C01)
Arabic Egypt 3073 (&HC01)
Arabic Iraq 2049 (&H801)
Arabic Jordan 11265 (&H2C01)
Arabic Kuwait 13313 (&H3401)
Arabic Lebanon 12289 (&H3001)
Arabic Libya 4097 (&H1001)
Arabic Morocco 6145 (&H1801)
Arabic Oman 8193 (&H2001)
Arabic Qatar 16385 (&H4001)
Arabic Saudi Arabia 1025 (&H401)
Arabic Syria 10241 (&H2801)
Arabic Tunisia 7169 (&H1C01)
Arabic U.A.E 14337 (&H3801
Arabic Yemen 9217 (&H2401)
Armenian 1067 (&H42B)
Assamese 1101 (&H44D)
Azeri Cyrillic 2092 (&H82C)
Azeri Latin 1068 (&H42C)
Basque 1069 (&H42D)
Belgian Dutch 2067 (&H813)
Belgian French 2060 (&H80C)
Bengali 1093 (&H445)
Portuguese (Brazil) 1046 (&H416)
Bulgarian 1026 (&H402)
Burmese 1109 (&H455)
Byelorussian (Belarusian) 1059 (&H423)
Catalan 1027 (&H403)
Chinese Hong Kong SAR 3076 (&HC04)
Chinese Macau SAR 5124 (&H1404)
Chinese Simplified 2052 (&H804)
Chinese Singapore 4100 (&H1004)
Chinese Traditional 1028 (&H404)
Croatian 1050 (&H41A)
Czech 1029 (&H405)
Danish 1030 (&H406)
Dutch 1043 (&H413)
English Australia 3081 (&HC09)
English Belize 10249 (&H2809)
English Canadian 4105 (&H1009)
English Caribbean 9225 (&H2409)
English Ireland 6153 (&H1809)
English Jamaica 8201 (&H2009)
English New Zealand 5129 (&H1409)
English Philippines 13321 (&H3409)
English South Africa 7177 (&H1C09)
English Trinidad 11273 (&H2C09)
English U.K. 2057 (&H809)
English U.S. 1033 (&H409)
English Zimbabwe 12297 (&H3009)
Estonian 1061 (&H425)
Faeroese 1080 (&H438)
Farsi 1065 (&H429)
Finnish 1035 (&H40B)
French 1036 (&H40C)
French Cameroon 11276 (&H2C0C)
French Canadian 3084 (&HC0C)
French Cote d'Ivoire 12300 (&H300C)
French Luxembourg 5132 (&H140C)
French Mali 13324 (&H340C)
French Monaco 6156 (&H180C)
French Reunion 8204 (&H200C)
French Senegal 10252 (&H280C)
French West Indies 7180 (&H1C0C)
French Congo (DRC) 9228 (&H240C)
Frisian Netherlands 1122 (&H462)
Gaelic Ireland 2108 (&H83C)
Gaelic Scotland 1084 (&H43C)
Galician 1110 (&H456)
Georgian 1079 (&H437)
German 1031 (&H407)
German Austria 3079 (&HC07)
German Liechtenstein 5127 (&H1407)
German Luxembourg 4103 (&H1007)
Greek 1032 (&H408)
Gujarati 1095 (&H447)
Hebrew 1037 (&H40D)
Hindi 1081 (&H439)
Hungarian 1038 (&H40E)
Icelandic 1039 (&H40F)
Indonesian 1057 (&H421)
Italian 1040 (&H410)
Japanese 1041 (&H411)
Kannada 1099 (&H44B)
Kashmiri 1120 (&H460)
Kazakh 1087 (&H43F)
Khmer 1107 (&H453)
Kirghiz 1088 (&H440)
Konkani 1111 (&H457)
Korean 1042 (&H412)
Lao 1108 (&H454)
Latvian 1062 (&H426)
Lithuanian 1063 (&H427)
FYRO Macedonian 1071 (&H42F)
Malayalam 1100 (&H44C)
Malay Brunei Darussalam 2110 (&H83E)
Malaysian 1086 (&H43E)
Maltese 1082 (&H43A)
Manipuri 1112 (&H458)
Marathi 1102 (&H44E)
Mongolian 1104 (&H450)
Nepali 1121 (&H461)
Norwegian Bokmol 1044 (&H414)
Norwegian Nynorsk 2068 (&H814)
Oriya 1096 (&H448)
Polish 1045 (&H415)
Portuguese 2070 (&H816)
Punjabi 1094 (&H446)
Rhaeto-Romanic 1047 (&H417)
Romanian 1048 (&H418)
Romanian Moldova 2072 (&H818)
Russian 1049 (&H419)
Russian Moldova 2073 (&H819)
Sami Lappish 1083 (&H43B)
Sanskrit 1103 (&H44F)
Serbian Cyrillic 3098 (&HC1A)
Serbian Latin 2074 (&H81A)
Sesotho 1072 (&H430)
Sindhi 1113 (&H459)
Slovak 1051 (&H41B)
Slovenian 1060 (&H424)
Sorbian 1070 (&H42E)
Spanish (Traditional) 1034 (&H40A)
Spanish Argentina 11274 (&H2C0A)
Spanish Bolivia 16394 (&H400A)
Spanish Chile 13322 (&H340A)
Spanish Colombia 9226 (&H240A)
Spanish Costa Rica 5130 (&H140A)
Spanish Dominican Republic 7178 (&H1C0A)
Spanish Ecuador 12298 (&H300A)
Spanish El Salvador 17418 (&H440A)
Spanish Guatemala 4106 (&H100A)
Spanish Honduras 18442 (&H480A)
Spanish Nicaragua 19466 (&H4C0A)
Spanish Panama 6154 (&H180A)
Spanish Paraguay 15370 (H3C0A)
Spanish Peru 10250 (&H280A)
Spanish Puerto Rico 20490 (&H500A)
Spanish Spain (Modern Sort) 3082 (&HC0A)
Spanish Uruguay 14346 (&H380A)
Spanish Venezuela 8202 (&H200A)
Sutu 1072 (&H430)
Swahili 1089 (&H441)
Swedish 1053 (&H41D)
Swedish Finland 2077 (&H81D)
Swiss French 4108 (&H100C)
Swiss German 2055 (&H807)
Swiss Italian 2064 (&H810)
Tajik 1064 (&H428)
Tamil 1097 (&H449)
Tatar 1092 (&H444)
Telugu 1098 (&H44A)
Thai 1054 (&H41E)
Tibetan 1105 (&H451)
Tsonga 1073 (&H431)
Tswana 1074 (&H432)
Turkish 1055 (&H41F)
Turkmen 1090 (&H442)
Ukrainian 1058 (&H422)
Urdu 1056 (&H420)
Uzbek Cyrillic 2115 (&H843)
Uzbek Latin 1091 (&H443)
Venda 1075 (&H433)
Vietnamese 1066 (&H42A)
Welsh 1106 (&H452)
Xhosa 1076 (&H434)
Zulu 1077 (&H435)