Set ATG Repository Item Date or Timestamp Properties to the Current Time

*Time* Ticking away... on Flickr *Time* Ticking away… by Michel Filion

This is a neat trick for automatically setting a date or timestamp property to the current time.  I learned it while perusing the ATG Repository Guide.

Date and Timestamp Properties

A repository item can use properties whose values are dates or timestamps, with the value set to the current date or time, using the java.util.Date, java.sql.Date, or java.sql.Timestamp classes. You can have a property whose value is set to the current time or date at the moment a repository item is created. You can do this by setting the feature descriptor attribute useNowForDefault. For example:
[xml]<property name="creationDate" data-type="timestamp">
<attribute name="useNowForDefault" value="true"/>
For more information about this technique, see the Assigning FeatureDescriptorValues with the <attribute> Tag section in this chapter.