public static String format(final Date dateTime, final String formatPattern) {
    return (dateTime != null ? new SimpleDateFormat(formatPattern).format(dateTime) : null);
  }
The DateTimeUtils class is a utility class for working with dates and times.
<p>

@see java.util.Calendar
@see java.text.DateFormat
@see java.util.Date
@since GemFire 8.0
geode-web-api/src/main/java/org/apache/geode/rest/internal/web/util/DateTimeUtils.java