betweenGo

Tag: useNowForDefault

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

by on Apr.19, 2010, under Repository

*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:

<property name="creationDate" data-type="timestamp">
  <attribute name="useNowForDefault" value="true"/>
</property>

For more information about this technique, see the Assigning FeatureDescriptorValues with the <attribute> Tag section in this chapter.

Share
Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!