I’ve begun development of the Android app for Batch and we use REST/JSON as our API.

Dates in JSON are represented as strings like:


I am also using the wonderful ORMLite framework to persist my objects in a local SQLite database. I would like to store my dates as UNIX timestamps using a type of “long”. By doing this I can do date filtering much faster by just having SQLite compare numbers instead of strings.

Thus, I need an easy and transparent way to marshal my dates from DateTime strings to Longs and back and forth. 

Fortunately I am using the Jackson JSON library which has killer custom serialization/deserialization support.