Tuesday, June 4, 2013

SharePoint Designer CAML - ddwrt:FormatDate with different FormatFlags

I was asked today again about changing the date formats on a list view.  The user had SP Designer open and I had to wrack my brain on the format codes for straight dates with no time attached. 

Using the following namespace attribute
xmlns:ddwrt=http://schemas.microsoft.com/WebParts/v2/DataView/runtime


Not what we wanted:

ddwrt:FormatDate(string(@EventDate), 1033, 5) => MM/DD/YYYY HH:MM AM/PM

What we wanted was:

ddwrt:FormatDate(string(@EventDate), 1033, 1) => MM/DD/YYYY

Here is the format chart



Thanks to http://panvega.wordpress.com/2008/12/08/ddwrtformatdate-with-different-formatflags/

No comments:

Post a Comment