Code example for TimeZone

Methods: getOffset

0
         
        // 
        // figure out whether we're before (-) or after (+) UTC 
        // 
        TimeZone timeZone = _FORMATTER.getTimeZone();
        long offset = timeZone.getOffset(date.getTime());
         
        char sign = offset < 0 ? '-' : '+';
        offset = Math.abs(offset);
         
        // 
        // figure out what comes after the +/- 
        //  
        long hours = offset / 3600000;
        long minutes = (offset % 3600000) / 60000;
         
        // 
        // add the +/- suffix and call it a day 
        //         
        int length = dateWithoutTimeZone.length() + 6;