@Test public void testToStandardDate() { int y = 1990; int m = 5; int d = 3; assertEquals("1990-05-03", DateUtils.toStandardDate(y, m, d)); y = 1990; m = 11; d = 3; assertEquals("1990-11-03", DateUtils.toStandardDate(y, m, d)); y = 1990; m = 5; d = 31; assertEquals("1990-05-31", DateUtils.toStandardDate(y, m, d)); y = 2018; m = 12; d = 31; assertEquals("2018-12-31", DateUtils.toStandardDate(y, m, d)); }
public static String toStandardDate(int year, int month, int day) { String yearStr = Integer.toString(year); String monthStr = Integer.toString(month); String dayStr = Integer.toString(day); if (month < 10) { monthStr = "0" + monthStr; } if (day < 10) { dayStr = "0" + dayStr; } StringBuilder builder = new StringBuilder(); builder.append(yearStr); builder.append('-'); builder.append(monthStr); builder.append('-'); builder.append(dayStr); return builder.toString(); }
DateUtils { public static String toStandardDate(int year, int month, int day) { String yearStr = Integer.toString(year); String monthStr = Integer.toString(month); String dayStr = Integer.toString(day); if (month < 10) { monthStr = "0" + monthStr; } if (day < 10) { dayStr = "0" + dayStr; } StringBuilder builder = new StringBuilder(); builder.append(yearStr); builder.append('-'); builder.append(monthStr); builder.append('-'); builder.append(dayStr); return builder.toString(); } }
DateUtils { public static String toStandardDate(int year, int month, int day) { String yearStr = Integer.toString(year); String monthStr = Integer.toString(month); String dayStr = Integer.toString(day); if (month < 10) { monthStr = "0" + monthStr; } if (day < 10) { dayStr = "0" + dayStr; } StringBuilder builder = new StringBuilder(); builder.append(yearStr); builder.append('-'); builder.append(monthStr); builder.append('-'); builder.append(dayStr); return builder.toString(); }  }
DateUtils { public static String toStandardDate(int year, int month, int day) { String yearStr = Integer.toString(year); String monthStr = Integer.toString(month); String dayStr = Integer.toString(day); if (month < 10) { monthStr = "0" + monthStr; } if (day < 10) { dayStr = "0" + dayStr; } StringBuilder builder = new StringBuilder(); builder.append(yearStr); builder.append('-'); builder.append(monthStr); builder.append('-'); builder.append(dayStr); return builder.toString(); }  static String toStandardDate(int year, int month, int day); static int[] fromStandardDate(String standardDate); }
DateUtils { public static String toStandardDate(int year, int month, int day) { String yearStr = Integer.toString(year); String monthStr = Integer.toString(month); String dayStr = Integer.toString(day); if (month < 10) { monthStr = "0" + monthStr; } if (day < 10) { dayStr = "0" + dayStr; } StringBuilder builder = new StringBuilder(); builder.append(yearStr); builder.append('-'); builder.append(monthStr); builder.append('-'); builder.append(dayStr); return builder.toString(); }  static String toStandardDate(int year, int month, int day); static int[] fromStandardDate(String standardDate);  }