java - How to compare time with correct PDT? -
java - How to compare time with correct PDT? -
i want compare time below, 2 result time values created calendar setting timezone "pst". when compare 2 times, result wrong.
log time: tue oct 06 17:21:17 pdt 1970, while action time: mon oct 06 17:49:47 pdt 2014
code 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));
i not see compare in code snippet, can't comment on code. should read on stackoverflow,
<how compare calendar's time java.sql.time object?>read this
see lion (2nd response in thread), explains everything, or can read java docs.
java calendar
Comments
Post a Comment