java - Date time and simple date time format results are different -
i have following code fragment: datetime datetime = new datetime().withzone(datetimezone.forid("america/chicago")) .withyear(2016) .withmonthofyear(8) .withdayofmonth(25) .withhourofday(12) .withminuteofhour(37); system.out.println("datetime: "); system.out.println(datetime.todate().gettime()); string str = "2016-8-25 12:37 cst"; simpledateformat sdf = new simpledateformat("yyyy-m-dd hh:mm z"); system.out.println("sdf: "); try { system.out.println(sdf.parse(str).gettime()+""); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } according understanding, both represent same date (and hence epoch should same well). result is: datetime: 1472146669119 sdf: 1451198220000 if change timezone cdt, ge...