JAVA报表两日期间月,周,日计算
//计算天数
public List day(String dates,String datee) throws ParseException{
List dayls=new ArrayList();
// 字符串转换成日期
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = format.parse(dates);
Calendar startTime = Calendar.getInstance();
startTime.clear();
startTime.setTime(startDate);
int startYear = startTime.get(Calendar.YEAR);
int startMonth = startTime.get(Calendar.MONTH);
int startDay = startTime.get(Calendar.DAY_OF_MONTH);
Date endDate = format.parse(datee);
Calendar endTime = Calendar.getInstance();
endTime.clear();
endTime.setTime(endDate);
int endYear = endTime.get(Calendar.YEAR);
int endMonth = endTime.get(Calendar.MONTH);
int endDay = endTime.get(Calendar.DAY_OF_MONTH);
int count = 0;
for (int x = startYear; x <= endYear; x++) {
// 罗马历法产生年份公元1582年
int gregorianCutoverYear = 1582;
// 判断是否是闰年
boolean isLeapYear = x >= gregorianCutoverYear ? ((x % 4 == 0) && ((x % 100 != 0) || (x % 400 == 0)))
: (x % 4 == 0);
// 获取开始月的最大天数;大月是1,3,5,7,8,10,12;小月是4,6,9,11;特殊月是2
int max = 0;
if (startMonth == 1) {
if (isLeapYear) {
max = 29;
}
if (!isLeapYear) {
max = 28;
}
}
if (startMonth == 3 || startMonth == 5 || startMonth == 8
|| startMonth == 10) {
max = 30;
}
if (startMo
相关文档:
File类
创建目录,用mkdir和mkdirs的函数
public boolean mkdir():创建此抽象路径名指定的目录。
public boolean mkdirs():创建此抽象路径名指定的目录,包括所有必需但不存在的父目录。注意,此操作失败时也可能已经成功地创建了一部分必需的父目录。
mkdir例子:
File dir = new File("E:/mydir/");
if(!di ......
本文来自CSDN博客:http://blog.csdn.net/xyk0830/archive/2007/11/06/1869638.aspx
命令行格式:
native2ascii.exe -[options] [inputfile [outputfile]]
其中:
-[options]表示命令开关,有两个选项可供选择:
-reverse:用Latin-1或Unicode编码把文件转换成本地编码格式
-encoding ......
在JSP里,获取客户端的IP地址的方法是:request.getRemoteAddr(),这种方法在大部分情况下都是有效的。但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了。
如果使用了反向代理软件,将http://192.168.1.110:2046/ 的URL反向代理为http://www.xxx.com/ 的URL时,用request.getRemoteAddr()方 ......
在网上也看了很多东西,关于JAVA软件架构方面的东西,现在还真是很难找到,不过,软件开发的架构基本是相同的。所以,我在网上查找了很多其他语言关于软件架构方面的文章。再这里也来说说自己对软件架构,特别是在JAVA项目架构方面的看法。说得不一定对,但这也是我几年来的总结吧。
1. 尽量不要考虑项目外的重用
许多人 ......
public class MyEclipseGen {
private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up ......