private void resolveTimeMacro(StringBuffer result){
  Calendar calendar=new GregorianCalendar();
  result.append(calendar.get(Calendar.YEAR) + "_");
  String month=calendar.get(Calendar.MONTH) + 1 + "";
  if (month.length() < 2) {
    month="0" + month;
  }
  result.append(month + "_");
  String day=calendar.get(Calendar.DAY_OF_MONTH) + "";
  if (day.length() < 2) {
    day="0" + day;
  }
  result.append(day + "-");
  int amPm=calendar.get(Calendar.AM_PM);
  String amPmString=amPm == Calendar.AM ? "AM" : "PM";
  result.append(amPmString + "_");
  String hour=calendar.get(Calendar.HOUR) + "";
  if (hour.length() < 2) {
    hour="0" + hour;
  }
  result.append(hour + "_");
  String minute=calendar.get(Calendar.MINUTE) + "";
  if (minute.length() < 2) {
    minute="0" + minute;
  }
  result.append(minute + "_");
  String second=calendar.get(Calendar.SECOND) + "";
  if (second.length() < 2) {
    second="0" + second;
  }
  result.append(second);
}

private void resolveTimeMacro ( StringBuffer result ) { Calendar calendar = new GregorianCalendar ( ) ; result . append ( calendar . get ( Calendar . YEAR ) + "_" ) ; String month = calendar . get ( Calendar . MONTH ) + 1 + "" ; if ( month . length ( ) < 2 ) { month = "0" + month ; } result . append ( month + "_" ) ; String day = calendar . get ( Calendar . DAY_OF_MONTH ) + "" ; if ( day . length ( ) < 2 ) { day = "0" + day ; } result . append ( day + "-" ) ; int amPm = calendar . get ( Calendar . AM_PM ) ; String amPmString = amPm == Calendar . AM ? "AM" : "PM" ; result . append ( amPmString + "_" ) ; String hour = calendar . get ( Calendar . HOUR ) + "" ; if ( hour . length ( ) < 2 ) { hour = "0" + hour ; } result . append ( hour + "_" ) ; String minute = calendar . get ( Calendar . MINUTE ) + "" ; if ( minute . length ( ) < 2 ) { minute = "0" + minute ; } result . append ( minute + "_" ) ; String second = calendar . get ( Calendar . SECOND ) + "" ; if ( second . length ( ) < 2 ) { second = "0" + second ; } result . append ( second ) ; }
resolves the macro t by writing the current date and time in the result buffer .
