MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / format

Method format

src/main/java/core/org/xbill/DNS/FormattedTime.java:35–48  ·  view source on GitHub ↗

Converts a Date into a formatted string. @param date The Date to convert. @return The formatted string.

(Date date)

Source from the content-addressed store, hash-verified

33 * @return The formatted string.
34 */
35public static String
36format(Date date) {
37 Calendar c = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
38 StringBuffer sb = new StringBuffer();
39
40 c.setTime(date);
41 sb.append(w4.format(c.get(Calendar.YEAR)));
42 sb.append(w2.format(c.get(Calendar.MONTH)+1));
43 sb.append(w2.format(c.get(Calendar.DAY_OF_MONTH)));
44 sb.append(w2.format(c.get(Calendar.HOUR_OF_DAY)));
45 sb.append(w2.format(c.get(Calendar.MINUTE)));
46 sb.append(w2.format(c.get(Calendar.SECOND)));
47 return sb.toString();
48}
49
50/**
51 * Parses a formatted time string into a Date.

Callers 2

rrToStringMethod · 0.95
rrToStringMethod · 0.95

Calls 3

appendMethod · 0.45
getMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected