mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-03-20 00:00:03 -04:00
Clean up: Moved test code from main method to test case.
This commit is contained in:
@@ -30,9 +30,6 @@ package com.twelvemonkeys.lang;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* A utility class with useful date manipulation methods and constants.
|
||||
@@ -191,20 +188,4 @@ public final class DateUtil {
|
||||
int offset = pTimeZone.getOffset(pTime);
|
||||
return (((pTime + offset) / DAY) * DAY) - offset;
|
||||
}
|
||||
|
||||
public static void main(String[] pArgs) throws ParseException {
|
||||
DateFormat format = new SimpleDateFormat("yyyy.MM.dd HH.mm.ss S");
|
||||
|
||||
long time = pArgs.length > 0 ? format.parse(pArgs[0]).getTime() : System.currentTimeMillis();
|
||||
|
||||
System.out.println(time + ": " + format.format(new Date(time)));
|
||||
time = roundToSecond(time);
|
||||
System.out.println(time + ": " + format.format(new Date(time)));
|
||||
time = roundToMinute(time);
|
||||
System.out.println(time + ": " + format.format(new Date(time)));
|
||||
time = roundToHour(time);
|
||||
System.out.println(time + ": " + format.format(new Date(time)));
|
||||
time = roundToDay(time);
|
||||
System.out.println(time + ": " + format.format(new Date(time)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user