package com.dayu.recharge.utils;
|
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
/**
|
* Created by zuoxiao on 2018/12/24.
|
*/
|
|
public class DateUtil {
|
|
|
public static String type1 = "yyyy-MM-dd HH:mm";
|
public static String type2 = "yyyy-MM-dd HH:mm:ss";
|
|
|
/*
|
* 将时间转换为时间戳
|
*/
|
public static String dateToStamp(long ts, String type) {
|
String res = "";
|
try {
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(type);
|
Date d1 = new Date(ts);
|
return simpleDateFormat.format(d1);
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return res;
|
}
|
|
|
}
|