1

I want to display Date only not time.

when I edit XSL file, I see below function :

<xsl:value-of select="ddwrt:FormatDateTimeUsingCurrentContext(string(@pro-date))" />

I am confuse which one from below to use to show only date?

ddwrt:FormatDateTimeUsingCurrentContext(string(@pro-date))

OR

ddwrt:FormatDateTime(@ActivityDate, 1033, 'MM/dd/yyyy')

3

FormatDateTimeUsingCurrentContext is used to format the field value with the default DateTime format setting of the current SharePoint server context.

As you can see, it only passes field value parameter as a string , no need to additional parameter like 'dd/MM/yy' because it should format this value as the default current settings ,

In case of, you need to customize this default format for a specific field so you should use

FormatDate(string szDate, long lcid, long formatFlag);

where formatFlag is the format of the displayed date as mentioned in this table

Eg: FormatDate(@Field, 1033, 1) should return 9/28/2016

enter image description here

Or use

FormatDateTime(string szDate, long lcid, string szFormat);

where szFormat is 'dd/MM/yyyy' represent 28/09/2016

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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