計算日期與時間

Posted by Bruce Tsai

狀況:自行計算

Date date = new Date();
date.getTime() + 24 * 60 * 60 * 1000;

正確做法:善用 Calendar (或Joda-Time)

Calendear date = Calendar.getInstance();
date.add(Calendar.Date, 1);

results matching ""

    No results matching ""