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"/>
</property>[/xml]
For more information about this technique, see the Assigning FeatureDescriptorValues with the <attribute> Tag section in this chapter.

2 thoughts on “Set ATG Repository Item Date or Timestamp Properties to the Current Time

  1. Hi.. I’m using Timestamp with Time Zone data type, what would be the xml representation for it?

Leave a Reply

Your email address will not be published. Required fields are marked *