on 08-17-2006 3:53 PM
hi
I have made a inputfield UI element of type date when i put type 020004 on that input field it changes to 02/01/2004 ,but i want to show some error when this kind of entry ,which however is not happening in present case.
How to do it?
please help me.
Regards
Nidhideep
Hi,
You are not getting an error because 02/01/2004 is a valid date.
If you create a simple type in your local dictionary, based on built in Date type, and on the representation tab you specify format: "dd/MM/yyyy" (or "MM/dd/yyyy") you will get the desired format. (Of course the input field must be bound to a context attribute of your custom date type).
Whatever the user types in the input field is mapped to some date. The user should be able to use a date navigator besides typing the date.
You wil have to do error checking yourself. E.g. if the date must be between e.g. 1950 and 2020, you must implement the validation for this yourself.
Good luck!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
I am able to change format.But I want to do some computation on my date like if(date1.before(date2))and other different function of date.I am not able to perform that function.I was using java.sql.Date for my previuos computation it works fine but i was in mm/dd/yy.What should i do?
Please help me.
Regards
Nidhideep
????
By creating a simple type in your dictionary, based on built in type date, you should still be able to compare dates using 'before()' and 'after()' functions.
Did you create a simple type? Does it have built in type date? Is your view element bound to this simple type?
Can you provide a code fragment that the compiler does not accept?
Regards, Roelof
Hi,
Still you can use before , after on the java.util.Date.
Here is a example. I am able to compare on util.Date classes.
String dateAsString = "14/06/2006";
String SecondDate = "18/08/2006";
java.util.Date dateFrom = null;
java.util.Date dateFromSecond = null;
try {
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
if (formatter != null && dateAsString != null) {
dateFrom = formatter.parse(dateAsString);
dateFromSecond = formatter.parse(SecondDate);
}
if(dateFrom.before(dateFromSecond)){
wdComponentAPI.getMessageManager().reportSuccess("First");
}else{
wdComponentAPI.getMessageManager().reportSuccess("Second");
}
}catch(Exception e){
}
Regards,
Sridhar
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.