Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error passing in a date object

user8742475Sep 8 2011 — edited Jul 18 2013
I'm calling Oracle CRM On Demand by generating a WS proxy of its WSDL file. There's a field of date datatype in CRMOD and in the java class, it accepts a Calendar object. Below is my code

Here's my code

1) I have a Date object
2) I found a piece of code on the internet to get the WS 2.0 ISO8601 DateTime format. This method will format my Date object and return a String as below

String dateString = "2011-09-08T00:00:00-0700-07:00";

3)
SimpleDateFormat dfISO8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
Date dt= dfISO8601.parse(dateString);

4)

Calendar cal = Calendar.getInstance();
cal.setTime(dt);

5) customObject.setDStartDate(cal);

but it kept saying

"The value '11-09-08-07:00' cannot be converted to a date time value.(SBL-DAT-00359)"

It looks like Calendar reverts back to the default date formatting which does not conform to XSD format.

Do you have any idea?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 15 2013
Added on Sep 8 2011
5 comments
3,171 views