Skip Headers
Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers
10g Release 3 (10.1.3.0)
B25947-01
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

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()));    
}