Skip Headers
Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers
10g (10.1.3.1.0)

Part Number B25947-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

9.11 How to Access the Current Date and Time

You might find it useful to reference the current date and time in your entity object business logic. Example 9-17 shows a helper method you can use to access the current date without any time information.

Example 9-17 Helper Method to Access the Current Date with No Time

/*
 * Helper method to return current date without time
 *
 * Requires import: oracle.jbo.domain.Date
 */
protected Date getCurrentDate() {
  return new Date(Date.getCurrentDate());
}

In contrast, if you need the information about the current time included as part of the current date, use the helper method shown in Example 9-18.

Example 9-18 Helper Method to Access the Current Date with Time

/*
 * Helper method to return current date with time
 *
 * Requires imports: oracle.jbo.domain.Date
 *                   java.sql.Timestamp
 */
protected Date getCurrentDateWithTime() {
  return new Date(new Timestamp(System.currentTimeMillis()));    
}