Replace tabs with spaces
This commit is contained in:
@@ -5,40 +5,40 @@ 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 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 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 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 TimeZone getTimeZone() {
|
||||
checkCalendar();
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
public static Calendar getCalendar() {
|
||||
checkCalendar();
|
||||
return calendar;
|
||||
}
|
||||
public static Calendar getCalendar() {
|
||||
checkCalendar();
|
||||
return calendar;
|
||||
}
|
||||
|
||||
protected static void checkCalendar() {
|
||||
if (calendar == null ) {
|
||||
setTimeZone(TIMEZONE);
|
||||
}
|
||||
}
|
||||
protected static void checkCalendar() {
|
||||
if (calendar == null ) {
|
||||
setTimeZone(TIMEZONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user