Created
September 9, 2013 05:19
Revisions
-
arcao created this gist
Sep 9, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ protected static Date parseJsonDate(String date) { Pattern DATE_PATTERN = Pattern.compile("/Date\\((-?\\d+)([-+]\\d{4})?\\)/"); Matcher m = DATE_PATTERN.matcher(date); if (m.matches()) { long time = Long.parseLong(m.group(1)); long zone = 0; if (m.group(2) != null && m.group(2).length() > 0) zone = Integer.parseInt(m.group(2)) / 100 * 1000 * 60 * 60; return new Date(time + zone); } logger.error("parseJsonDate failed: " + date); return new Date(0); }