天天看點

string轉換為timestap時間類型

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String dateString = dateFormat.format(new Date());

        System.out.println(dateString);

        Timestamp ts = new Timestamp(System.currentTimeMillis());

        ts =  Timestamp.valueOf(dateString);