import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.io.IOException;
import java.io.StringWriter;
+import java.util.Date;
import java.util.Optional;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
}
private static long startOfDay(long now) {
- return parseDate(formatDate(now)).getTime();
+ return parseDate(formatDate(new Date(now))).getTime();
}
private int frequency() {
return THREAD_SAFE_DATE_FORMAT.format(d);
}
- public static String formatDate(long ms) {
- return THREAD_SAFE_DATE_FORMAT.format(new Date(ms));
- }
-
public static String formatDateTime(Date d) {
return THREAD_SAFE_DATETIME_FORMAT.format(d);
}
@Test
public void shouldFormatDate() {
assertThat(DateUtils.formatDate(new Date())).startsWith("20");
- assertThat(DateUtils.formatDate(new Date().getTime())).startsWith("20");
assertThat(DateUtils.formatDate(new Date()).length()).isEqualTo(10);
- assertThat(DateUtils.formatDate(new Date().getTime()).length()).isEqualTo(10);
}
@Test