FileManDateTimeFormat { public static DateTimeFormatter dateTime() { if (dt == null) { dt = new DateTimeFormatterBuilder() .append(date()) .append(dot()) .append(time()) .toFormatter(); } return dt; } protected  FileManDateTimeFormat(); static DateTimeFormatter date(); static DateTimeFormatter time(); static DateTimeFormatter dateTime(); static PointInTimeFormatter pointInTimeParser(); static PointInTime parse(String text); static PointInTime toPointInTime(String text); static PointInTime parsePointInTime(String text); static LocalDateTime parseLocalDateTime(String text);  }
@Test public void testFormatPointInTime() { Assert.assertEquals("2750000", FileManDateTimeFormat.dateTime().print(new PointInTime(1975))); Assert.assertEquals("2750700", FileManDateTimeFormat.dateTime().print(new PointInTime(1975, 7))); Assert.assertEquals("2750723", FileManDateTimeFormat.dateTime().print(new PointInTime(1975, 7, 23))); Assert.assertEquals("2750723.10", FileManDateTimeFormat.dateTime().print(new PointInTime(1975, 7, 23, 10))); Assert.assertEquals("2750723.1056", FileManDateTimeFormat.dateTime().print(new PointInTime(1975, 7, 23, 10, 56))); Assert.assertEquals("2750723.105614", FileManDateTimeFormat.dateTime().print(new PointInTime(1975, 7, 23, 10, 56, 14))); Assert.assertEquals("2750723.105614", FileManDateTimeFormat.dateTime().print(new PointInTime(1975, 7, 23, 10, 56, 14, 456))); Assert.assertEquals("3010000", FileManDateTimeFormat.dateTime().print(new PointInTime(2001))); }
@Test public void testFormatDateTime() { Assert.assertEquals("3010911.000000", FileManDateTimeFormat.dateTime().print(new DateTime(2001, 9, 11, 0, 0, 0, 0))); }
@Test public void testParseDateTime() { DateTime t = FileManDateTimeFormat.dateTime().parseDateTime("2750723.105614"); Assert.assertEquals(1975, t.getYear()); Assert.assertEquals(7, t.getMonthOfYear()); Assert.assertEquals(23, t.getDayOfMonth()); Assert.assertEquals(10, t.getHourOfDay()); Assert.assertEquals(56, t.getMinuteOfHour()); Assert.assertEquals(14, t.getSecondOfMinute()); Assert.assertEquals(0, t.getMillisOfSecond()); }