时间戳1591258482的十六进制表示结果

               

public class test2 {


    //将时间戳(如:1591258482)转化为十六进制表示
    public static String to16Hex(Date date) {
        Long ab = date.getTime()/1000;
        String a = Long.toHexString(ab);
        return a;
    }


    public static void main(String[] args)  throws Exception{
        
        // 现在时间+10年 
        Date expiration = new Date(System.currentTimeMillis() + 3600l* 1000*24*365*10);
        String t = test2.to16Hex(expiration);
        System.out.println("t:"+t);
  
    }



}  

 

你可能感兴趣的:(java,java)