DateTimeValue implements Value { @Override public Object getValue() { try { synchronized (DATE_FORMAT) { return DATE_FORMAT.parse(DATE_FORMAT.format(timestamp)); } } catch (ParseException pex) { return null; } } DateTimeValue(long timestamp);  DateTimeValue(String dt); @Override String toString(); @Override Object getValue(); @Override long asLong(); @Override double asDouble(); @Override String asString();  }
@Test public void test() { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); df.setTimeZone(TimeZone.getTimeZone("UTC")); long ts = System.currentTimeMillis(); DateTimeValue dtv = new DateTimeValue(ts); try { assertTrue(dtv.getValue().equals(df.parse(df.format(new Date(ts))))); } catch (ParseException pex) { fail(pex.getMessage()); } }