function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EatEat 

Easy Java Problem for someone - Dates

Hi, I am using the Partner WSDL, and I am trying to get dates out of the MessageElements.

Say I have:


qr = binding.query("select id, firstName, createdDate from Contact");

for (int i = 0; i < qr.getRecords().length; i++) {
SObject con = qr.getRecords()[i];
org.apache.axis.message.MessageElement[] me = con.get_any();
String fName = me[0].getValue();
String createddate = me[1].getValue(); //CAN I GET THE DATE HERE?
}



For the last line, is there an easy way to get the MessageElement[i] into java.util.Date? (or Calendar or GregorianCalendar)


Thanks for anyone's help
DevAngelDevAngel

Here is how to convert from iso-8601 to calendar object:

 private void DateTester() {
  String testDate = "2004-07-07T16:26:02.96+08:30";
  org.apache.axis.encoding.ser.CalendarDeserializer cds = new org.apache.axis.encoding.ser.CalendarDeserializer(java.util.Calendar.class, null);
  java.util.Calendar c = (java.util.Calendar)cds.makeValue(testDate);
  System.out.println(c.getTime().toString());
 }

EatEat
Awesome, I'll try that out, thanks Dave