on 03-13-2007 5:20 PM
Hi,
Need to send a date to back-end, when i make it a string it gives me the following format YYYY-MM-DD, but I want to pass it as a date type in the format DD.MM.YYYY how do I do that.
regards
Hi Eoin,
If back end is R/3 system, u can pass java.sql.Date as date which worked for me. No need of convering it to dd.mm.yyyy format.
For example, if u want to pass todays date, then pass
new java.sql.Date(System.currentTimeMillis())
Regards
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Eoin,
/*1*/ SimpleDateFormat fmtIn = new SimpleDateFormat("yyyy-MM-dd");
/*2*/ Date date = fmtIn.parse("2007-03-14");
/*3*/ SimpleDateFormat fmtOut = new SimpleDateFormat("dd.MM.yyyy");
/*4*/ String out = fmtOut.format(date);
If type of wdContext.currentContextElement().getEffective_Date() is String then pass it instead of constant to /2/, if it is Date then start directly with line /3/ and comment out /1/ and /2/.
Finally call inputPS.setEffective_Date(out);
Valery Silaev
SaM Solutions
Message was edited by:
Valery Silaev
Hi Eoin,
You cant create a date object with format dd.MM.yyyy
In java, there are 2 date types
1. java.sql.Date . Its format is yyyy-MM-dd
2. java.util.Date . Its format is yyyy/MM/dd
So we can pass the date object to RFC only in the above two formats. Otherwise we can pass dd.MM.yyyy as a string to RFC or we can convert a string enterd by user in dd.MM.yyyy format to any of the above date formats and pass that date object.
I dont know why ur RFC is not accepting sql date because it worked perfectly for me and I think sql date will work for all RFCs.
What error u r getting while calling RFC ?
Regards
Fahad Hamsa
Hi Eoin,
You want to change the date format to YYYY-MM-DD.
This can be done by creating a variable of type java.sql.Date.
You must have a context of type 'date' binded to ur input field, just take the value of that context into a variable of java.sql.Date type as:
java.sql.Date Convert_date = wdContext.current<ur context node name>.get<Context attribute name>;
You can then use Convert_date.toString() function to display it.
Hope it Helps.
Regards,
Alka.
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.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.