左晓为主开发手持机充值管理机
zuoxiao
2024-05-09 b8f8323cc39091d3119101923251a0455da87f55
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.dayu.baselibrary.utils;
 
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;
    }
 
 
}