package org.helioviewer.jhv.base.time;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

import org.apache.commons.lang3.time.FastDateFormat;

public class TimeUtils {

    public static final TimeZone UTC = TimeZone.getTimeZone("UTC");

    private static final String SQL_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static final long DAY_IN_MILLIS = 86400000;

    public static final FastDateFormat utcDateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss", UTC);
    public static final FastDateFormat sqlDateFormat = FastDateFormat.getInstance(SQL_DATE_FORMAT, UTC);
    public static final FastDateFormat utcFullDateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS", UTC);
    public static final FastDateFormat apiDateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss'Z'");
    public static final FastDateFormat filenameDateFormat = FastDateFormat.getInstance("yyyy-MM-dd_HH.mm.ss");
    public static final FastDateFormat timeDateFormat = FastDateFormat.getInstance("HH:mm:ss");
    public static final FastDateFormat dateFormat = FastDateFormat.getInstance("yyyy-MM-dd");

    public static final JHVDate Epoch = JHVDate.parseDateTime("2000-01-01T00:00:00");

    private static final TimeUtils instance = new TimeUtils();

    public static TimeUtils getSingletonInstance() {
        return instance;
    }

    private TimeUtils() {
    }

    /**
     * Gets the date of give date with hour, minute, seconds, milliseconds to 0.
     *
     * @param date
     *            the date to round
     * @return the rounded date
     */
    public static Date getCurrentDate(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.set(Calendar.HOUR, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }

    /**
     * Gets the date rounded up to the following day. So day+1, hour, minute,
     * second, millisecond 0.
     *
     * @param date
     *            The date to round up.
     * @return The rounded up date on the day
     */
    public static Date getNextDate(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.DAY_OF_MONTH, 1);
        c.set(Calendar.HOUR, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }

}

@@ -37,58 +37,8 @@
 e;%0A%0A
-import java.util.Calendar;%0Aimport java.util.Date;%0A
 impo
@@ -1365,1069 +1365,6 @@
  %7D%0A%0A
-    /**%0A     * Gets the date of give date with hour, minute, seconds, milliseconds to 0.%0A     *%0A     * @param date%0A     *            the date to round%0A     * @return the rounded date%0A     */%0A    public static Date getCurrentDate(Date date) %7B%0A        Calendar c = Calendar.getInstance();%0A        c.setTime(date);%0A        c.set(Calendar.HOUR, 0);%0A        c.set(Calendar.MINUTE, 0);%0A        c.set(Calendar.SECOND, 0);%0A        c.set(Calendar.MILLISECOND, 0);%0A        return c.getTime();%0A    %7D%0A%0A    /**%0A     * Gets the date rounded up to the following day. So day+1, hour, minute,%0A     * second, millisecond 0.%0A     *%0A     * @param date%0A     *            The date to round up.%0A     * @return The rounded up date on the day%0A     */%0A    public static Date getNextDate(Date date) %7B%0A        Calendar c = Calendar.getInstance();%0A        c.setTime(date);%0A        c.add(Calendar.DAY_OF_MONTH, 1);%0A        c.set(Calendar.HOUR, 0);%0A        c.set(Calendar.MINUTE, 0);%0A        c.set(Calendar.SECOND, 0);%0A        c.set(Calendar.MILLISECOND, 0);%0A        return c.getTime();%0A    %7D%0A%0A
 %7D%0A

Remove unused functions