package com.fri.http.rest.utils;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * Created by zhangdahui on 2017/5/1.
 */
public class TimeUtils {

    public static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");

    public static long currentStamp(){
        return System.currentTimeMillis();
    }

    public static String currentStampAsString(){
        return String.valueOf(System.currentTimeMillis());
    }

    public static String toDateAsString(long stamp){
        Timestamp timeStamp = new Timestamp(stamp);
        String time = df.format(timeStamp);
        return time;
    }

    public static String currentDateAsString(){
        return toDateAsString(currentStamp());
    }

}
