Search code examples
javadatetimejcrhippocms

Convert Hippo JCR datetime to Java format


I use JCR Query to get some news from Hippo repository. and as result I getting date in this format:

2011-04-07T08:34:13.093Z

can someone tell me how can I convert it to like this:

07-04-2011 08:34

in a simple way.

Thanks!!


Solution

  • You can do this using SimpleDateFormat:

    ParsePosition pp = new ParsePosition(0);
    SimpleDateFormat hippoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
    Date javaDate = hippoFormat.parse("2011-04-07T08:34:13.093Z", pp)