package com.kfzs.duanduan.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by HooRang on 2017/3/3.
 */
public class DateFormatUtils {

    private static final String FORMAT = "yyyy-MM-dd HH:mm";
    private static final String BOOKFORMAT = "MM/dd HH:mm";

    private static final String UPDATE_FORMAT = "yyyy-MM-dd";
    private static final String UPDATE_FORMAT_NO_YEAR = "MM/dd HH:mm 首发";
    private static final String UPDATE_FORMAT_DEFAULT = "yyyy年MM月dd日 HH:mm";
    private static final String UPDATE_FORMAT_OPEN_SERVE = "开服时间：yyyy年MM月dd日 HH:mm";
    private static final String UPDATE_FORMAT_OPEN_TEST = "开测时间：yyyy年MM月dd日 HH:mm";

    public static String doSecond2Date(long timestamp) {
        return doSecond2Date(timestamp, FORMAT);
    }

    public static String doDefaultDate(long timestamp) {
        return doSecond2Date(timestamp, UPDATE_FORMAT_DEFAULT);
    }

    public static String doOpenserveDate(long timestamp) {
        return doSecond2Date(timestamp, UPDATE_FORMAT_OPEN_SERVE);
    }

    public static String doOpenTestDate(long timestamp) {
        return doSecond2Date(timestamp, UPDATE_FORMAT_OPEN_TEST);
    }

    public static String doBookDate(long timestamp) {
        return doSecond2Date(timestamp, BOOKFORMAT);
    }

    public static String doSecond2DateNoYear(long timestamp) {
        return doSecond2Date(timestamp, UPDATE_FORMAT_NO_YEAR);
    }

    public static String doSecondDate(long time) {

        return doSecond2Date(time, UPDATE_FORMAT);
    }

    public static String doSecond2Date(long timestamp, String format) {
        DateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(new Date(timestamp * 1000));
    }


}
