Initial commit

This commit is contained in:
2014-11-30 12:23:51 +00:00
commit 63c559ec90
56 changed files with 2543 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
package util;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class DateUtils {
public static final String TIMEZONE = "Europe/Amsterdam";
protected static TimeZone timeZone;
protected static Calendar calendar;
public static void setTimeZone(String timeZone) {
DateUtils.timeZone = TimeZone.getTimeZone(timeZone);
calendar = new GregorianCalendar(DateUtils.timeZone);
}
public static long makeTimestamp(int year, int month, int day, int hour, int minute, int second, int millisecond) {
checkCalendar();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
calendar.set(Calendar.DATE, day);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
calendar.set(Calendar.MILLISECOND, millisecond);
return calendar.getTimeInMillis();
}
public static TimeZone getTimeZone() {
checkCalendar();
return timeZone;
}
public static Calendar getCalendar() {
checkCalendar();
return calendar;
}
protected static void checkCalendar() {
if (calendar == null ) {
setTimeZone(TIMEZONE);
}
}
}