复制代码代码如下:
com.infomorrow.dao 包;
导入 java.sql.Timestamp;
导入 java.util.Calendar;
导入 java.util.TimeZone;
导入 org.junit.Test;
公共类测试日期{
@测试
公共无效测试(){
今天时间戳 = new Timestamp(Calendar.getInstance(TimeZone.getTimeZone("GMT+8")).getTimeInMillis());
int年份=today.getYear()+1900;
int 月份=today.getMonth()+1;
int day = Today.getDate();
字符串日期 = 年+"-"+月+"-"+日;
System.out.println("日期:"+日期);
System.out.println(今天);
}
}
// 输出
日期:2013-12-17
2013-12-17 13:04:30.809