Code example for SimpleTimeZone

0
        return history;
    } 
 
    private Date parseDate(String dateString) throws ParseException {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleTimeZone tz = new SimpleTimeZone(0, "GMT");
        formatter.setTimeZone(tz);
        return formatter.parse(dateString);
    } 
 
    private String getElapsedTime(java.util.Date from, java.util.Date to) {
        long toTime = to.getTime();
        long fromTime  = from.getTime();
        long elapsed = (toTime - fromTime);
 
        long elapsedHour = elapsed / (60*60*1000);
        elapsed -= elapsedHour * (60*60*1000);
 
        long elapsedMin = elapsed / (60*1000);
        elapsed -= elapsedMin * 60*1000;
        long elapsedSec = elapsed / 1000;