package com.cavaness.quartzbook.chapter3;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Calendar,可以设定一个时间
* @author Kevin
*
*/
public class DateTest {
private static Log log = LogFactory.getLog(DateTest.class);
/**
* @param args
*
*/
public static void main(String[] args) {
DateTest dateTest = new DateTest();
dateTest.testCalendart();
}
/**
*/
public void testCalendart() {
Calendar calendar = Calendar.getInstance();
calendar.set(2012, 5, 1, 15, 50, 23); // 2012.06.01 15:50:23
Date date = calendar.getTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
log.info(simpleDateFormat.format(date));// 2012.06.01 15:50:23
}
}
6.Calendar,可以设定一个时间
最新推荐文章于 2022-07-23 16:28:34 发布