@Override
    public StringBuffer format(Object obj, StringBuffer result, FieldPosition pos) {
        return format.format(toArgs((Attributes) obj), result, pos);
    }
@Test
    public void testDateTimeOffset() {
        Attributes attrs = new Attributes(1);
        attrs.setString(Tag.StudyDate, VR.DA, "20111012");
        attrs.setString(Tag.StudyTime, VR.TM, "0930");
        assertEquals("2011/09/12/10/00",
                new AttributesFormat("{00080020,date-P1M,yyyy/MM/dd}/{00080030,time+PT30M,HH/mm}")
                        .format(attrs));
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MONTH, -1);
        cal.add(Calendar.MINUTE, 30);
        assertEquals(new SimpleDateFormat("yyyy/MM/dd/HH/mm").format(cal.getTime()),
                new AttributesFormat("{now,date-P1M,yyyy/MM/dd}/{now,time+PT30M,HH/mm}")
                        .format(attrs));
    }