Java Date decrease or increase
来源:互联网 发布:ubuntu 14.04 u盘 编辑:程序博客网 时间:2024/05/16 11:28
import java.util.Date;
public class test1111
{
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
java.util.Calendar c = new java.util.GregorianCalendar();
c.setTime(new Date());
System.out.println("Year:Month:Day"+c.get(c.YEAR)+"-"+(c.get(c.MONTH)+1)+"-"+c.get(c.DATE));
c.add(c.MONTH,-1);
System.out.println("Year:Month:Day"+c.get(c.YEAR)+"-"+(c.get(c.MONTH)+1)+"-"+c.get(c.DATE));
}
}
*****************************************************************************************************************
package com.ice.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static String getStringDateFormat(Date date, String dateformat) {
SimpleDateFormat sf = new SimpleDateFormat(dateformat);
return sf.format(date);
}
public static Date getRMDate(Date nowdate) {
Calendar c=Calendar.getInstance();
c.setTime(nowdate);
System.out.println(DateUtil.getStringDateFormat(c.getTime(), "yyyy-MM-dd"));
c.add(c.MONTH, -1);
System.out.println(DateUtil.getStringDateFormat(c.getTime(), "yyyy-MM-dd"));
return new Date();
}
public static void main(String[] args) throws ParseException {
Date date =new Date();
DateUtil.getRMDate(date);
}
}
- Java Date decrease or increase
- B. Increase and Decrease
- Increase and Decrease
- Increase and Decrease
- Increase and Decrease--codeForces 246B
- CodeForces 246B: Increase and Decrease【水】
- Codeforces 246B Increase and Decrease 【数学】
- Codeforces 246B-Increase and Decrease【模拟】
- CodeForces 246BB. Increase and Decrease【思维】
- CodeForces 246B Increase and Decrease
- Codeforces 246B Increase and Decrease
- 【Codeforces 246B Increase and Decrease 】
- CF - 246 - B. Increase and Decrease(贪心)
- CodeForces - 246B Increase and Decrease (模拟)水
- CUIT ACM Personal Training 11.27(FM)G - Increase and Decrease
- Java format date to String or String to date
- ora-01440:column to be modified must be empty to decrease precision or scale
- oracle : olumn to be modified must be empty to decrease precision or scale
- 职位:C++开发人员(都是北京职位)
- 正则表达式
- 转 关于查询语句
- The Inventor Mentor-第十五章 拖拽器和操作器
- C++引用
- Java Date decrease or increase
- 千万别入错行 导师送给我的15条人生建议
- 职位:售前工程师(北京)
- 常量叠算(Constant folding),还是叫常量合并更合适点,呵呵
- 人生建议
- 说话艺术12条
- Spring2.0配置文件加载util标签的Schema
- 诊断 Java 代码: 轻松掌握 Java 泛型
- 设置IE每次访问页面是检查所存网页的较新版本