Skip to main content
Published: September 12 2007, 5:40:00 PMUpdated: August 03 2022, 2:52:18 PM

There is no data wrapper type in the eBay JAVA SDK nor in javax.xml, how can I parse the Duration value returned in GetItem call?

Detailed Description
 

    The Item TimeLeft element is represented in the standard Duration ISO 8601 format : PnYn MnDTnH nMnS. In JAVA SDK the property is returned in ItemType.getTimeLeft() getter in the object of javax.xml.datatype.Duration type.

   To parse the value, you just simply call the getTimeLeft() getter of the ItemType object directly as  :

   String itemID ="";
   ItemType item = new ItemType(new ItemIDType(itemID));


   System.out.println(item.getTimeLeft());

   System.out.println("Time Left :  [ D"+item.getTimeLeft().getDays() +" H" +item.getTimeLeft().getHours()+ " M" +item.getTimeLeft().getMinutes() + " ]" );

 


 

Additional Resources

 

How well did this answer your question?
Answers others found helpful