1. 程式人生 > >解決資料庫中查出時間多一個.0的解決辦法

解決資料庫中查出時間多一個.0的解決辦法

如資料庫查詢時間為:2018-9-28 10:33:20.0

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

String time = format.format(format.parse(p.getStopTime()));

這樣查出來的time 為2018-9-28 10:33:20