This is what I did to resolve. Use UTC TimeZone to resolve these type of issues.
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss").withZone(DateTimeZone.UTC); DateTime dateTimeUTC = new DateTime(formatter.parseDateTime(dateString)); Long epocTime = dateTimeUTC.getMillis();
Always store epocTime in database rather than storing the Date values.
No comments:
Post a Comment