Example usage for org.joda.time.format FormatUtils appendPaddedInteger

List of usage examples for org.joda.time.format FormatUtils appendPaddedInteger

Introduction

In this page you can find the example usage for org.joda.time.format FormatUtils appendPaddedInteger.

Prototype

public static void appendPaddedInteger(Appendable appendable, long value, int size) throws IOException 

Source Link

Document

Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer.

Usage

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;
}