Date Only format with BCS
-
16-10-2019 - |
문제
I have created an External Content Type through SharePoint Designer. One of the fields that I'm getting from my database is a DateTime column. In SharePoint, however, I want to format this as a Date only. At the moment it's coming through as
2011-05-06 00:00:00z
I want something like:
2011-05-06
Or ideally:
06-05-2011
It sounds really simple, but I can find little information on how to achieve this. Have I missed something really obvious? Is this achievable? I do not want to have to modify the database (that will take time and administration)
EDIT: the particular problem is a date column within the External Data Picker, and the External Content type is only being used for an External Data column.
해결책 3
It doesn't appear that this is possible at this time, which is annoying. Kudos for Roel for his tip on doing this for an External List.
다른 팁
There is an article in the DUET info on MSDN that shows you how to do this: http://msdn.microsoft.com/en-us/library/gg271157.aspx
I think you can do it as follows as well (since an external content type is still a content type; however I have not tested this): - Create your external list from the external content type - Go into the external lists you have created for your site in sharepoint designer - In the right hand corner you can see the views. Your external list should have a default view. Click on it and the file should open in sharepoint designer.
Look for a snippet like this:
<XmlDefinition>
<View Name="{62A0ABCF-DF9D-45DD-985E-46ECDC9F5004}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="SmartAppList" Url="/Lists/ghjghj/ReadList.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png">
<Method Name="ReadList"/>
<Query>
<OrderBy>
<FieldRef Name="Id"/>
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Id" ListItemMenu="TRUE" LinkToItem="TRUE"/>
<FieldRef Name="Name"/>
<FieldRef Name="Description"/>
<FieldRef Name="ConfigurationXml"/>
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off"/>
<Toolbar Type="Standard"/>
</View>
</XmlDefinition
>
- At the fieldref for your field you should be able to add the format attribute. This allows you to change the display of the date/time field.
Refer to http://msdn.microsoft.com/en-us/library/aa543225.aspx for possible values.
From SharePoint designer:
Replace:
$thisNode/@*[name()=current()/@Name]
With
substring-before($thisNode/@*[name()=current()/@Name], ' ')