0

I want to compare the time as below, the two result time values are created by Calendar with setting timezone to "PST". When I compare the two times, the result is always wrong.

Log time: Tue Oct 06 17:21:17 PDT 1970, while action time: Mon Oct 06 17:49:47 PDT 2014

Code is like below:

Calendar calendar = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
df.setTimeZone(TimeZone.getTimeZone("PST"));
s = newLine.substring(0, 17);
calendar.setTime(df.parse(s));
PM 77-1
  • 12,933
  • 21
  • 68
  • 111
Catheryan
  • 111
  • 1
  • 1
  • 8

1 Answers1

-2

I do not see any compare in your code snippet, thus can't really comment on the code. You should read this on stackoverflow,

<How to compare Calendar's time to java.sql.Time object?>Read This

See Lion (2nd response in the thread), it basically explains everything, or you can just read the Java docs.

Community
  • 1
  • 1
omerfar23
  • 34
  • 3