15 December 2010

Define your alternative format/pattern for af:inputDate

You want to input date in your page without using the ADF predefined pattern eg. 7/7/1977
but just writing 07071977
then
use  secondaryPattern="ddMMyyyy"

Also,
Check for Common patterns at  java.text.SimpleDateFormat.

Test if your pattern is valid, on the Online SimpleDateFormat Test.


Note: 
The Pattern and SecondaryPattern string of af:convertDateTime should respect the pattern syntax specified by the java.text.SimpleDateFormat.

Note2:
Of course you can also define pattern property, instead of taking it from bindings, but it is better to define it in the UI hints of VO attribute and access it from bindings.
Most probably the pattern in the VO's attr UI hints follows the above pattern syntax, too. Although the available formats are defined in formatinfo.xml (under JDev system dir), other values are accepted (eg. I remember using "yyyy-MM-dd hh:mm:ss" which is not specified in the  formatinfo.xml, but is a valid pattern).

Example:



Src:



1 comment:

  1. This is old but worth a shot. Using your snippet above, try changing the the pattern (both) to DDD for day of year. Can you select the date from the calendar or does it populate the textbox with "(Day in Year)"?

    ReplyDelete

You might also like:

Related Posts Plugin for WordPress, Blogger...