获取今天,昨天,上个月的日期 的方法: Calendar cal = Calendar.getInstance(); //获取今天的日期 cal.setTime(new Date()); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH)+1; int day = cal.get(Calendar.DAY_OF_MONTH); logger.debug(year + " 年 " + month +
java 获取日期的几天前,几个月前和几年前. package bys.utils; import java.util.Date; /** * Created by toutou on 2015/3/23. */ public class DateHelper { public static final long ONE_MINUTE = 60000L; public static final long ONE_HOUR = 3600000L; public static final long
java获取取得Timestamp类型的当前系统时间java获取取得Timestamp类型的当前系统时间 格式:2010-11-04 16:19:42 方法1: Timestamp d = new Timestamp(System.currentTimeMillis()); 方法2: Date date = new Date(); Timestamp nousedate = new Timestamp(date.getTime()); ------------------------