on 02-14-2009 7:21 AM
Hi all, in me webdynpro application I have taken Date type for the Input Field.
At date select it is displaying in the format
*2/14/2009 i.e. mm/dd/yyyy*
And when I am saving date in the sql database then the date format changes to..
2009-02-14 i.e..yyyy/mm/dd.
But using the Date format method I have changed the format as per the need to push date in the SQL database table...
In the table SQL the date attribute is in form i.e. 02/14/2009 as like from the date select from the date Input Fieldu2026But the problem is that database is not being able to display in that Input field again.
I have use the coding both at Insertion and selection of the database i.e..
Date Sdate, Edate;
Sdate = Date.valueOf (rs.getString ("Sdate"));
Edate = Date.valueOf (rs.getString ("Edate"));
SimpleDateFormat date Formatter = new SimpleDateFormat ("MM/dd/yyyy");
Sdate = wdContext.currentProjectElement ().getEdate ();
Edate = wdContext.currentProjectElement ().getEdate ();
String Sd = dateFormatter.format (Sdate);
String Ed = dateFormatter.format (Edate);
Date Sdd =Date.valueOf (Sd);
Date Edd =Date.valueOf (Ed);
But at selection of the database the error for the date format isu2026.
java.lang.IllegalArgumentException
If somebody knows how to resolve this ,plz let me know
Regards:
SK
thanx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for displaying the value only, I think, you are converting to string.
sol1:
1. Create a simple type in dictionary: under Dictionary -> Local Dictionary -> Simple Types
2. go to Definition tab: Change Built-in Type as Date
3. go to Representation tab: specify format e.g.: MM/dd/yyyy
4. go to Context and change the date context attribute to the created type.
sol2:
please try to minimize the casting between Date and String.
I believe in database date is stored as Date type itself. My suggestion will be for displaying keep a separate attribute and set it on each db call.
below code is converting from Date to String.
Date Sdate, Edate;
Sdate = rs.getDate ("Sdate");
Edate = rs.getDate ("Edate");
SimpleDateFormat date Formatter = new SimpleDateFormat ("MM/dd/yyyy");
String Sd = dateFormatter.format (Sdate);
String Ed = dateFormatter.format (Edate);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi nikhil thanx for helping..I hav tried both d solutions but problem persist...
Basically in inserting the date in sql server is in date format using Input field and again accessing that date frm the SQL server to display again in that Input field of date format..
wenever i am acessing date frm sql server database table its displaying the error
IllegalFormatException...
Even i tried to display that date value in msg but same error ...
How shud i display the date value frm SQLserver in the same InoutField from were the date has been inserted initially...
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.