Java各种时间转换(时间转换成毫秒比较,date转换成字符串,字符串转成date)

//把date转成以下格式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

//------------------------------------------
        Timestamp arriveTime = reinfotocw.get(0).getArriveTime();
        //获取当前时间转成毫秒
        Calendar calendar=Calendar.getInstance();
        long timeInMillis = calendar.getTimeInMillis();

        //获取得到的时间转成毫秒
        Calendar calendar1 = Calendar.getInstance();
        calendar1.setTime(arriveTime);
        long timeInMillis1 = calendar1.getTimeInMillis();

        if(timeInMillis

 

你可能感兴趣的:(问题解决,java,时间)