Skip to content

Instantly share code, notes, and snippets.

@ProgramAlgo
Created December 25, 2018 08:43
Show Gist options
  • Save ProgramAlgo/9fe3ea3f0ad78998d2048ae32798c074 to your computer and use it in GitHub Desktop.
Save ProgramAlgo/9fe3ea3f0ad78998d2048ae32798c074 to your computer and use it in GitHub Desktop.
OData JSON Date Object to Timestamp
// OData json date string "/Date(1545727221)" to Timestamp
Pattern pattern = Pattern.compile("(\\d+)");
String onboardingDate = "/Date(1545727221)";
Matcher matcher = pattern.matcher( onboardingDate );
if (matcher.find()) {
String matched = matcher.group();
Timestamp dateToValidate = new Timestamp(Long.parseLong(matched));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment