原文地址:http://bdcwl.blog.163.com/blog/static/765222652009104171521/ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = sdf.parse("2009-11-04");//String-->Date String sdate = sdf.format(date );// Data-->String Ti
package lianxi; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class date { public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(" yyyy-MM-dd E
方法一:利用Calendar类来获取当前日期和时间,代码如下: /** * 获取系统时间 * @return */ public String getDate(){ Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR);//获取年份 int month=calendar.get(Calendar.MONTH);//获取月份 int day=calendar.get(Calendar.D
/** * java获取 当月所有的日期集合 * @return */public static List<Date> getDayListOfMonth() { List list = new ArrayList(); Calendar aCalendar = Calendar.getInstance(Locale.CHINA); int year = aCalendar.get(Calendar.YEAR);//年份 int month = aCalendar.get(Calendar.M