import java.text.SimpleDateFormat; import java.util.Calendar; public class Test { public static void main(String[] args) { //获取当前时间 Calendar cal = Calendar.getInstance(); //下面可以设置月份,注:月份设置要减1,所以设置1月就是1-1,设置2月就是2-1,如此类推 cal.set(Calendar.MONTH, 1-1); /
package huolongluo.family.util; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * Created by 火龙裸 on 2018/7/13. */ public class Number_Of_Days { /** * 获取当月的 天数 */ public static int getCurrentMonthDay() { Calend
public Timestamp strToDate(int type){ Timestamp time = null; DateFormat format2= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; Calendar cale = Calendar.getInstance(); cale.add(Calendar.DATE, type); String tarday = new SimpleDate
原文地址: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