Question: I am trying to modify the date format displayed in a custom template using the field. What I want to display is this:

> 
> This page was last modified on 29 Jan
>  2010 by Joel Spolsky
> 
> 
> 

(where the user name links to their profile).

I found some good examples here on <http://mindsharpblogs.com/aaron/archive/2008/02/08/4283.aspx> which helped me get the custom template set up. And I looked through the class members on the [MSDN documentation](http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.createdmodifiedinfo_members.aspx). But I cannot figure out how to modify the date format.

Is there any way to pass a date format string such as "**d MMM yyyy**" to the FieldValue to use for rendering?

This is my current code which works except the date format comes in as 29/01/2010 19:22 which isn't as user-friendly. 

```
<SharePoint:CreatedModifiedInfo ControlMode="Display" runat="server">
        <CustomTemplate>
            This page was last modified on
            <SharePoint:FieldValue FieldName="Modified" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/>
            by
            <SharePoint:FormField FieldName="Author" runat="server" ControlMode="Display" DisableInputFieldLabel="true" />
        </CustomTemplate>
</SharePoint:CreatedModifiedInfo>

```

Answer: 
I have a preference for using XPath these days. I've run into issues using PowerShell's xml adapter that are annoying like the name collision on `item`:

```
$xml = [xml]@'
  <Users> 
    <User Name="Foo"> 
      <Friends> 
        <Friend Name="Bar"/> 
      </Friends> 
    </User> 
    <User Name="Foo2" /> 
    <User Name="Foo3"> 
      <Friends> 
        <Friend Name="Bar"/> 
      </Friends> 
    </User> 
  </Users> 
'@

Select-Xml '//User[contains(Friends/Friend/@Name, "Bar")]' $xml |%{$_.Node.Name}

```
In this case I would use XPath as well. @TomWij provided the correct xpath.

In case that the xpath expression would be too complicated, I would for sure used the 'classic' approach.

```
$x.Users.User | ? { $_.Friends.Friend.Name -eq 'Bar' }

```

(in this case if you don't have script mode on, it doesn't matter that there is no `Friends` element. `$_.Friends` will return `$null` and `$null.Friend` returns `$null` as well and so on. So finally `$null -eq 'Bar'` returns false and the element is removed by Where-Object)