Getting the current system time

When the multi time zone deployment feature is enabled, all of the time zone sensitive fields are operated in UTC within the frame of preExecute and postExecute. Instead of using System.currentTimeMillis() to return the current system time, developers should instead use one of the following methods:
  • DWLDateTimeUtilities.getCurrentSystemTime – Returns the current system time in UTC when the multi time zone deployment feature is enabled. When the feature is not enabled, the method returns the current time in the application server's time zone. Use this method when there is a requirement to work with the current time within the frame of preExecute and postExecute.
  • DWLDateTimeUtilities.getCurrentSystemTimeInUserTimeZone – Returns the current time in the requester's time zone when the multi time zone deployment feature is enabled. When the feature is not enabled, the method returns the current time in the application server's time zone. Use this method when there is a requirement to work with the current time outside of the frame of preExecute and postExecute (either before preExecute or after postExecute).

Note on behavior extensions that use the current system time (inside the pre/post frame): For extensions in which you are writing additional logic to customize or enhance the behavior of a transaction, the calls to the behavior extension will take place in the preExecute or postExecute parts of the transaction. In preExecute, UTC conversions are completed before the extensions are handled. Similarly, data is converted back to the requester time zone in postExecute after the extensions are handled. Consequently, within the behavior extensions, all of the time zone sensitive fields will be in UTC, so if there is a requirement to work with the current time, use DWLDateTimeUtilities.getCurrentSystemTime instead of System.currentTimeMillis().

Note on composite transactions that use the current system time (outside of the pre/post frame): For composite transactions, you can group together related transactions and run them as a single unit of work using a business proxy. In this situation, if there is business logic outside of the preExecute and postExecute frame that compares the business object's timestamp to the current system time, use DWLDateTimeUtilities.getCurrentSystemTimeInUserTimeZone instead of System.currentTimeMillis().