私の知る限り、オプションのパターンはありません。しかし、あなたは自分の問題を考えすぎているのではないかと思います。
// Sample variable name - you'd probably name this better.
public static DateTimeFormat LONG_FORMATTER = DateTimeFormatter.forPattern("yyyy MM dd HH:mm:ss.SSS");
// Note that this could easily take a DateTime directly if that's what you've got.
// Hint hint non-null valid date hint hint.
public static String formatAndChopEmptyMilliseconds(final Date nonNullValidDate) {
final String formattedString = LONG_FORMATTER.print(new DateTime(nonNullValidDate));
return formattedString.endsWith(".000") ? formattedString.substring(0, formattedString.length() - 4) : formattedString;
}
長さは部分文字列(テストされていないコード)に対して正確に正しくない可能性がありますが、あなたはその考えを理解します。