You can do what @demobox suggested or, if all dates returned by the CloudSigma 
API have the same iso8601 format, you can bind to the context a DateAdapter 
that parses dates taking that format into account. Jclouds already comes with a 
[Iso8601DateAdapter](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/config/GsonModule.java#L216-L239)
 to parse dates, so if you want to parse dates like this by default, you can 
then avoid writing a parser and just configure it in a Guice module. Something 
like:

```java
public class CloudSigmaParserModule extends AbstractModule {
   @Override
   protected void configure() {
      bind(DateAdapter.class).to(Iso8601DateAdapter.class);
   }
}
```

Then, add that module to the default modules in the CloudSigma ApiMetadata 
class, and you are done. jclouds-chef parses dates like this by default. You 
can take a look at the 
[ChefParserModule](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/config/ChefParserModule.java)
 (at the end) and to the 
[ChefApiMetadata](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/ChefApiMetadata.java)
 to see an example.

Either the approach suggested by @demobox and this one are good ways to handle 
that. It depends on your needs and how your API works!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21677597

Reply via email to