 |
|
ss
Oracle Tips by Burleson |
PICK_DATE_FORMAT_MASK
This is a user defined substitution string at the
application level. This is the best way to keep the dates consistent
throughout an application. The one caveat would be if the developer
wants to use a combination of date only formats and date/time
formats. In that case, it would make sense to choose the format most
often used and set the PICK_DATE_FORMAT_MASK accordingly.
Creating the PICK_DATE_FORMAT_MASK is done on the
edit application attributes page described in a previous chapter. For
the information that follows, the following PICK_DATE_FORMAT_MASK was
setup.
Using the PICK_DATE_FORMAT_MASK in report columns
is as easy as using the substitution string for the Date Format
attribute of a column. See Figure 10.18 for an example.
Data in a web page is displayed as text and
working with dates can be tricky at times. Using the
PICK_DATE_FORMAT_MASK, as shown in the next two examples, can make
working with dates easier.
Formatting data while selecting it from the
database can be performed by including the PICK_DATE_FORMAT_MASK in a
TO_CHAR function as shown here:
TO_CHAR( order_timestamp, :PICK_DATE_FORMAT_MASK )
Updating data in a database column from a page
item also requires a conversion for the text representation of a date
to the date format the database column is expecting. This can be done
by using the PICK_DATE_FORMAT_MASK in a TO_DATE function as shown
here:
TO_DATE( :P100_ORDER_DATE, :PICK_DATE_FORMAT_MASK )
SINCE
Have you noticed in HTML DB that there are reports
showing information such as “2 weeks ago,” “22 hours ago,” or “35
minutes ago?” This is a date format known as SINCE. Putting the
string SINCE into the Date Format of a page item will cause the date
to be formatted in this manner. The ago time is rounded, but this is
a simple way to provide this kind of date formatting. Figure 10.19
shows the date format setting and a sample of what it produces.
The above book excerpt is from:
Easy HTML-DB
Oracle Application Express
Create
Dynamic Web Pages with OAE
ISBN 0-9761573-1-4
Michael Cunningham & Kent Crotty
http://www.rampant-books.com/book_2005_2_html_db.htm
|