package mechendddate
import javatextParseExceptionimport javatextSimpleDateFormatimport javautilCalendarimport javautilDate
import javaxswingtextStyleContextSmallAttributeSet
public class TestDate {
public static void main(String[] args) throws ParseException {
Date now = new Date()//取运行的时间Systemoutprintln(now)
long s = SystemcurrentTimeMillis()//取当前据 所过的毫秒数for(int i = i <= i++) {
} long e = SystemcurrentTimeMillis()Systemoutprintln(es)
SimpleDateFormat sdf = new SimpleDateFormat(yyyymmdd hhmmss)//将Date转换为特定的格式String str = sdfformat(now)Systemoutprintln(str)
String ss = Date d = sdfparse(ss)//将特定格式日期转换为Date Systemoutprintln(d)
Calendar n = CalendargetInstance()//获取它的实例注意是抽象类不能用new Systemoutprintln(n)nset( )//设定日期// int today = ngetTime()getDay()Systemoutprintln(ngetTime())int dd = nDAY_OF_WEEK//是该周的第几天Systemoutprintln(dd)}
}