- 浏览: 790735 次
- 性别:
- 来自: 上海
-
文章列表
众所周知,在程序开发中,难免会遇到需要匹配、查找、替换、判断字符串的情况发生,而这些情况有时又比较复杂,如果用纯编码方式解决,往往会浪费程序员的时间及精力。因此,学习及使用正则表达式,便成了解决这一矛 ...
- 2009-09-22 09:38
- 浏览 711
- 评论(0)
Date函数总结
请记得要引入java.util.Date和java.text.SimpleDateFormat两个包
Calendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year); //year 为 int
time.set(Calendar.MONTH,i-1);//注意,Calendar对象默认一月为0
int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//本月份的天数
注:在使用set方法之前,必须先clea ...
- 2009-09-21 17:11
- 浏览 1364
- 评论(0)
java时间日期函数
一:字符串转换成时间及时间相减:
1:) SimpleDateFormat formatter = new SimpleDateFormat ("yyyy.MM.dd");
//假定像2002.07.04的是合法日期其他都非法。
String str="2002.07.04";
ParsePosition pos = new ParsePosition(0);
Date dt=formatter.parse(str,pos);
if(dt!=null)
{
//是合法日期
}
else
{
//非法日期
}
...
- 2009-09-21 17:00
- 浏览 835
- 评论(0)