Replaces <tt>%Z</tt> and <tt>%z</tt> directives with +zone+ and +formatted_offset+, respectively, before passing to
 Time#strftime, so that zone information is correct
767002
def strftime(format)
      format = format.gsub('%Z', zone).gsub('%z', formatted_offset(false))
      time.strftime(format)
    end
10689
private static String getClientTimeZone() {
        return ZonedDateTime.now(SPDateTimeUtil.getTimeZoneId(SPDateTimeUtil.getBrowserTimeZone())).getOffset().getId()
                .replaceAll("Z", "+00:00");
    }
1113698
def remove_timezone(cls, timestr):
        
        if re.match(r".*[\-+]?\d{2}:\d{2}$", timestr):
            return re.sub(
                r"(.*)(\s[\+-]?\d\d:\d\d)$",
                r"\1",
                timestr
            )
937405
def format_modified(self, modified, sep=" "):
        
        if modified is not None:
            return modified.strftime("%Y-%m-%d{0}%H:%M:%S.%fZ".format(sep))
        return u""
569784
public static String changeFormatAndTimeZone(String isoTimestamp,
            String toBeTimeFormat, String zoneId) {
        return getTime(changeIsoTimestampToLong(isoTimestamp, zoneId),
                toBeTimeFormat, zoneId);
    }
783910
public static String timestampToString(long ts, int precision, TimeZone tz) {
		int p = (precision <= 3 && precision >= 0) ? precision : 3;
		String format = DEFAULT_DATETIME_FORMATS[p];
		return dateFormat(ts, format, tz);
	}
214920
def tzname(self, dt):
        
        if self.__is_daylight_time(dt):
            return time.tzname[1]
        else:
            return time.tzname[0]
631920
def _make_string_formatter(f, offset=None):
  
  format = f
  delta = offset
  return lambda v: time.strftime(format, (_date(v, delta)).timetuple())
557586
function formatTimezoneOffset (minutes) {
  let sign = simpleSign(negateExceptForZero(minutes))
  minutes = Math.abs(minutes)
  let hours = Math.floor(minutes / 60)
  minutes -= hours * 60
  let strHours = String(hours)
  let strMinutes = String(minutes)
  if (strHours.length < 2) strHours = '0' + strHours
  if (strMinutes.length < 2) strMinutes = '0' + strMinutes
  return (sign === -1 ? '-' : '+') + strHours + strMinutes
}
1048762
private synchronized void initializeTimeZoneFormat(boolean bForceUpdate) {
        if (bForceUpdate || tzFormat == null) {
            tzFormat = TimeZoneFormat.getInstance(locale);

            String digits = null;
            if (numberFormat instanceof DecimalFormat) {
                DecimalFormatSymbols decsym = ((DecimalFormat) numberFormat).getDecimalFormatSymbols();
                digits = new String(decsym.getDigits());
            } else if (numberFormat instanceof DateNumberFormat) {
                digits = new String(((DateNumberFormat)numberFormat).getDigits());
            }

            if (digits != null) {
                if (!tzFormat.getGMTOffsetDigits().equals(digits)) {
                    if (tzFormat.isFrozen()) {
                        tzFormat = tzFormat.cloneAsThawed();
                    }
                    tzFormat.setGMTOffsetDigits(digits);
                }
            }
        }
    }
931167
function formatClientTimezone8601 () {
		var now = new Date(),
			tzo = now.getTimezoneOffset() * -1, // invert
			dif = tzo >= 0 ? '+' : '-',
			pad = function (num) {
				var norm = Math.abs(Math.floor(num));
				return (norm < 10 ? '0' : '') + norm;
			};
		return dif + pad(tzo / 60) + ':' + pad(tzo % 60);
	}
351302
def iso8601_format( time )
      value = apply_utc_offset(time)

      str = value.strftime('%Y-%m-%dT%H:%M:%S')
      str << ('.%06d' % value.usec)

      offset = value.gmt_offset.abs
      return str << 'Z' if offset == 0

      offset = sprintf('%02d:%02d', offset / 3600, offset % 3600 / 60)
      return str << (value.gmt_offset < 0 ? '-' : '+') << offset
    end
520640
def current_offset(local_tz=None):
    
    if local_tz is None:
        local_tz = DEFAULT_LOCAL_TZ
    dt = local_tz.localize(datetime.now())
    return dt.utcoffset()
1235259
def isoformat(self):
        
        text = [self.strftime('%Y-%m-%dT%H:%M:%S'), ]
        if self.tzinfo:
            text.append(self.tzinfo.as_timezone())
        else:
            text.append('+00:00')
        return ''.join(text)
327784
private void setTzFormatString(final  TimeZone tz )
    {
        int zIndex = _formatString.indexOf( "ZZZ" );
        if( zIndex >= 0 )
        {
            String ss1 = _formatString.substring( 0, zIndex );
            String ss2 = _formatString.substring( zIndex+3 );
            int tzOffset = tz.getRawOffset();
            
            StringBuffer sb = new StringBuffer(_formatString.length()+10);
            sb.append(ss1);
            sb.append("'");
            if( tzOffset >= 0 )
                sb.append( '+' );
            else
            {
                tzOffset = -tzOffset;
                sb.append( '-' );
            }
            
            int raw = tzOffset / (1000*60);		// Convert to seconds
            int hr = raw / 60;
            int min = raw % 60;
            
            if( hr < 10 )
                sb.append( '0' );
            sb.append( hr );
            if( min < 10 )
                sb.append( '0' );
            sb.append( min );
            sb.append( '\'' );
            
            sb.append(ss2);
            _tzFormatString=sb.toString();            
        }
        else
            _tzFormatString=_formatString;
        setMinFormatString();
    }
809938
def normalize(dt, tz):
    
    if not isinstance(tz, tzinfo):
        tz = pytz.timezone(tz)
    dt = tz.normalize(dt)
    return dt
866646
def _add_tzinfo(self, datetime_obj, tz_string):
        
        if datetime_obj is None:
            return None

        tzinfo_match = tz.gettz(tz_string)
        return datetime_obj.replace(tzinfo=tzinfo_match)