MCPcopy Create free account
hub / github.com/apache/tomcat / formatDate

Method formatDate

java/org/apache/catalina/ssi/SSIMediator.java:459–471  ·  view source on GitHub ↗

Formats a date using the configured strftime pattern and the given time zone. @param date the date to format @param timeZone the time zone to use, or null for the default @return the formatted date string

(Date date, TimeZone timeZone)

Source from the content-addressed store, hash-verified

457 * @return the formatted date string
458 */
459 protected String formatDate(Date date, TimeZone timeZone) {
460 String retVal;
461 if (timeZone != null) {
462 // we temporarily change strftime. Since SSIMediator is inherently single-threaded, this isn't a problem
463 TimeZone oldTimeZone = strftime.getTimeZone();
464 strftime.setTimeZone(timeZone);
465 retVal = strftime.format(date);
466 strftime.setTimeZone(oldTimeZone);
467 } else {
468 retVal = strftime.format(date);
469 }
470 return retVal;
471 }
472
473
474 /**

Callers 1

setDateVariablesMethod · 0.95

Calls 3

getTimeZoneMethod · 0.80
setTimeZoneMethod · 0.80
formatMethod · 0.65

Tested by

no test coverage detected