List of usage examples for org.joda.time.format FormatUtils appendPaddedInteger
public static void appendPaddedInteger(Appendable appendable, long value, int size) throws IOException
From source file:org.openehr.rm.datatypes.quantity.datetime.DvDateTimeParser.java
License:LGPL
static String convertTimeZone(int tzMillis, boolean isExtended) { if (tzMillis == 0) return "Z"; int offset = Math.abs(tzMillis) / 60000; //timezone in minutes int hour = offset / 60; int minute = Math.abs(offset % 60); StringBuffer sb = new StringBuffer(); FormatUtils.appendPaddedInteger(sb, hour, 2); if (isExtended) { sb.append(":"); }/*from www .j a v a 2 s. com*/ FormatUtils.appendPaddedInteger(sb, minute, 2); String result = sb.toString(); return tzMillis < 0 ? "-" + result : "+" + result; }