public static String dateTimeToString(DateTime input, String format, String timezone) {
    String tz = StringUtils.defaultString(timezone, ConfigurationKeys.DEFAULT_SOURCE_TIMEZONE);
    DateTimeZone dateTimeZone = getTimeZone(tz);
    DateTimeFormatter outputDtFormat = DateTimeFormat.forPattern(format).withZone(dateTimeZone);
    return outputDtFormat.print(input);
  }
public static String dateTimeToString ( DateTime input , String format , String timezone ) { String tz = StringUtils . defaultString ( timezone , ConfigurationKeys . DEFAULT_SOURCE_TIMEZONE ) ; DateTimeZone dateTimeZone = getTimeZone ( tz ) ; DateTimeFormatter outputDtFormat = DateTimeFormat . forPattern ( format ) . withZone ( dateTimeZone ) ; return outputDtFormat . print ( input ) ; }
Convert joda time to a string in the given format
@param input timestamp
@param format expected format
@param timezone time zone of timestamp
@return string format of timestamp