import java.util.Date;import android.text.format.DateFormat;2. 设置时间格式:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");3. 获取时间:
Date curDate = new Date(System.currentTimeMillis());//PROCESSINGDate endDate = new Date(System.currentTimeMillis());long diff = endDate.getTime() - curDate.getTime();这样获取的就是时间间隔了,并且是ms级别的。