SharePoint !NEW Item Icon

It’s a simple little thing to put into your DVWP, but by adding this little snippet of XSL:

<xsl:if test="ddwrt:IfNew(string(@Created))">
    <IMG SRC="/_layouts/1033/images/new.gif" alt="New" />
</xsl:if>

you can automagically get the little New! Icon icon we’re all so used to seeing if an item has been created within a fixed set of time.  The ddwrt:IfNew function simply tests to see if the date you pass it has occurred since the days-to-show-new-icon property value on your server.  Don’t forget that you can pass a date in other than Created should you want to test something else.  If you are doing this in a DVWP, of course, you can also use an icon which is different than /_layouts/1033/images/new.gif.

By default the days-to-show-new-icon property is set to 2 days, but you can change this property with STSADM:

stsadm.exe -o setproperty -pn days-to-show-new-icon -pv [number_of_days] -url [servername]

If you’d rather not see the icon at all, then set the property to 0.