TimeUtils { public static String getDateTimeString(Attribute dateAttr, Attribute timeAttr) { String date = dateAttr != null ? dateAttr.getStringValue() : null; String time = timeAttr != null ? timeAttr.getStringValue() : null; if (date != null) { if (date.endsWith("UTC")) { date = date.substring(0, date.length() - 3).trim(); } if (date.startsWith("UTC=")) { date = date.substring(4, date.length()).trim(); } } if (time != null) { if (time.endsWith("UTC")) { time = time.substring(0, time.length() - 3).trim(); } if (time.startsWith("UTC=")) { time = time.substring(4, time.length()).trim(); } } if (date != null && time != null) { return date + " " + time; } if (date != null) { return date + (date.indexOf(':') == -1 ? " 00:00:00" : ""); } if (time != null) { return time + (time.indexOf(':') == -1 ? " 00:00:00" : ""); } return null; }  static ProductData.UTC getSceneRasterTime(NetcdfFile ncFile, String dateAttrName, String timeAttrName); static String getDateTimeString(Attribute dateAttr, Attribute timeAttr); static ProductData.UTC parseDateTime(String dateTimeStr);  }
@Test public void testGetDateTimeString() throws Exception { String dateTimeString = TimeUtils.getDateTimeString(new Attribute("start_date", "2010-01-31"), new Attribute("start_time", "10:00:22")); assertEquals("2010-01-31 10:00:22", dateTimeString); }