Created
December 25, 2018 08:43
-
-
Save ProgramAlgo/9fe3ea3f0ad78998d2048ae32798c074 to your computer and use it in GitHub Desktop.
OData JSON Date Object to Timestamp
This file contains 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 characters
// 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