First you store your output date from IS in some DATE type data Variable (goto Bindings-> Managed Beans-> yourPortlet/default Right Click on it–> Add–> Data. here give some Property name and set Property type as java.util.Date)
Now write some action() and inside it write java code like this.
For suppose your propertyName is “dateHolder”, then
int date=getDateHolder().getDate() // returns Date ex: 18
int month=getDateHolder().getMonth() // returns Month ex: 06
int year= getDateHolder().getYear() // returns Year ex: 2006
now you can store in String as
String Full_Date= date+“/”+month+“/”+year;
Hopefully i guess it should work…it worked for me when i am taking input from DateInput and binded it to Date property. Does not matter whether it is from DateInput or IS service it should work…
Thanks for your reply. I am sure that will work. However, I do not want to take that path or any of the other many options in which we can achieve this using Date and String manipulations / conversions.
The reason is due to
a) its just not the way it should be!
b) sheer volume of screens and fields that are affected by this.
c) maintainability
d) get an understanding of how it is meant to be achieved in the CAF/WS/IS environment.
e) get an understanding of any limitations and workarounds since this is a very basic operation that almost every CAF implementation will have.
I will wait for some more time for replies before I unwillingly want to make it just work in whatever way.
Hi Raj,
I suppose, from what you say about the “Formatted Date Converter”, that you are showing your “date” field in a text input/output control.
I tried using both a “Date and Time” converter and a “Formatted Date Time”, and both worked fine.
Set Time Displayed = false
Set Date Pattern = dd/MM/yyyy
I tried as well using a Date Input control, set its properties
Display → Pattern = “dd/MM/yyyy”
“Show Time” = false
and it worked fine. I left the Value → Value Pattern property empty (used when the property is bound to a String).
The problem is neither with java.util.Date nor xsd:date. It is with CAF control “Formatted Text”. Formatted Date formats a Date object to include “00:00:00” if there is no time in the Date Object. In Firefox, it is rendered as “12:00:00 AM”.
I know you may be asking why did you use Formatted Text instead of Text. The reason is to apply some of the UI aesthetics.
Looks like this is the reason that none of the Conversions were working. Formatted Text probably overrides conversions.