点点滴滴

来源:互联网 发布:怎样删除kingroot软件 编辑:程序博客网 时间:2024/05/19 03:42


private static final Logger log = Logger.getLogger(LoanContractAction.class);
log.error(getText("word2pdf方法有异常"), ex);


jsp隐藏:style="display: none;"
$("#id").show()  //放在div中      $("#id").hide()


/* js代码   选中有效天数不同的值,计算并显示天数后的第二天日期*/
function foundDate(){
 var tian = $('#validDate').val();
 tian = tian * 24 * 60 * 60 * 1000;
 var now = new Date();
 now.setTime(now.getTime() + tian + (1 * 24 * 60 * 60 * 1000));
 var finalDate = now.getFullYear()+'年'+(now.getMonth()+1)+'月'+now.getDate()+'日';
 $('#realDate').val(finalDate);
}


SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(loanInfo.getPayDate());


获取sql查询到的list数组的中的每个对象的属性值:
for(Iterator iter = list.iterator(); iter.hasNext();) {
 Object[] t = (Object[])iter.next();
 System.out.println(t[0]+","+ t[1]);
}
select t.ought_capital,t.ought_interest from l_proceeds_plan t where t.loan_id='960' and t.user_id='373' and
 rownum<=(select count(lb.id) from l_bid_info lb where lb.loan_id='960' and lb.user_id='373') order by t.plan_date


// 将数字转化为大写
public String numToUpper(int num) {
 String u[] = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
 char[] str = String.valueOf(num).toCharArray();
 String rstr = "";
 for (int i = 0; i < str.length; i++) {
       rstr = rstr + u[Integer.parseInt(str[i] + "")];
 }
 return rstr;
}

获取路径
request.getServletPath());=========/webPage/invest/webLoanContractAction_getContractTemplate.do
(实用)request.getContextPath());===========/p2p
(最实用)request.getSession().getServletContext().getRealPath("/"));======E:\Eclipse\User\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\p2p\
request.getRequestURI());========/p2p/webPage/invest/webLoanContractAction_getContractTemplate.do


JAVA Calendar详解
 public static void main(String[] args) { //日期显示,计算,年、月、日加减……
  SimpleDateFormat dateformat = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 ");
  Calendar calendar = Calendar.getInstance();
 
  Date date = calendar.getTime(); // 从一个 Calendar 对象中获取 Date 对象
  System.out.println(dateformat.format(calendar.getTime())); //2014年03月10日 17时32分55秒 当前时间
 
  //set(int year, int month, int day, int hour, int minute, int second) 设置"年/月/日/小时/分钟/秒/微秒"等值
// calendar.setTime(new Date()); //可以直接放入日期
  calendar.set(2014, 3, 10, 0, 0, 0); //月份的起始值为0而不是1,所以要设置八月时,我们用7而不是8
  System.out.println(dateformat.format(calendar.getTime())); //2014年04月10日 00时00分00秒
 
  calendar.set(Calendar.MONTH, 8); //设置日期的月份为九月
  System.out.println(dateformat.format(calendar.getTime())); //2014年09月10日 00时00分00秒
 
  calendar.set(Calendar.DAY_OF_MONTH, 31); //设置日期为31号
  System.out.println(dateformat.format(calendar.getTime())); //2014年10月01日 00时00分00秒 说明Calendar 对象有容错性
 
  //add() 的功能非常强大,add 可以对 Calendar 的字段进行计算。如果需要减去值,那么使用负数值就可以了;
  //当被修改的字段超出它可以的范围时,那么比它大的字段会自动修正
  calendar.set(2014, 7, 31, 0, 0 , 0); //2000-8-31
  calendar.add(Calendar.MONTH, 1); //2000-9-31 => 2000-10-1,对吗? //add()非常实用,月份加减用
  System.out.println(dateformat.format(calendar.getTime())); //结果是 2000-9-30
 }

private static final Logger log = Logger.getLogger(LoanContractAction.class);
log.error(getText("word2pdf方法有异常"), ex);


jsp隐藏:style="display: none;"
$("#id").show()  //放在div中      $("#id").hide()


/* js代码   选中有效天数不同的值,计算并显示天数后的第二天日期*/
function foundDate(){
 var tian = $('#validDate').val();
 tian = tian * 24 * 60 * 60 * 1000;
 var now = new Date();
 now.setTime(now.getTime() + tian + (1 * 24 * 60 * 60 * 1000));
 var finalDate = now.getFullYear()+'年'+(now.getMonth()+1)+'月'+now.getDate()+'日';
 $('#realDate').val(finalDate);
}


SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(loanInfo.getPayDate());


获取sql查询到的list数组的中的每个对象的属性值:
for(Iterator iter = list.iterator(); iter.hasNext();) {
 Object[] t = (Object[])iter.next();
 System.out.println(t[0]+","+ t[1]);
}
select t.ought_capital,t.ought_interest from l_proceeds_plan t where t.loan_id='960' and t.user_id='373' and
 rownum<=(select count(lb.id) from l_bid_info lb where lb.loan_id='960' and lb.user_id='373') order by t.plan_date


// 将数字转化为大写
public String numToUpper(int num) {
 String u[] = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
 char[] str = String.valueOf(num).toCharArray();
 String rstr = "";
 for (int i = 0; i < str.length; i++) {
       rstr = rstr + u[Integer.parseInt(str[i] + "")];
 }
 return rstr;
}

获取路径
request.getServletPath());=========/webPage/invest/webLoanContractAction_getContractTemplate.do
(实用)request.getContextPath());===========/p2p
(最实用)request.getSession().getServletContext().getRealPath("/"));======E:\Eclipse\User\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\p2p\
request.getRequestURI());========/p2p/webPage/invest/webLoanContractAction_getContractTemplate.do


JAVA Calendar详解
 public static void main(String[] args) { //日期显示,计算,年、月、日加减……
  SimpleDateFormat dateformat = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 ");
  Calendar calendar = Calendar.getInstance();
 
  Date date = calendar.getTime(); // 从一个 Calendar 对象中获取 Date 对象
  System.out.println(dateformat.format(calendar.getTime())); //2014年03月10日 17时32分55秒 当前时间
 
  //set(int year, int month, int day, int hour, int minute, int second) 设置"年/月/日/小时/分钟/秒/微秒"等值
// calendar.setTime(new Date()); //可以直接放入日期
  calendar.set(2014, 3, 10, 0, 0, 0); //月份的起始值为0而不是1,所以要设置八月时,我们用7而不是8
  System.out.println(dateformat.format(calendar.getTime())); //2014年04月10日 00时00分00秒
 
  calendar.set(Calendar.MONTH, 8); //设置日期的月份为九月
  System.out.println(dateformat.format(calendar.getTime())); //2014年09月10日 00时00分00秒
 
  calendar.set(Calendar.DAY_OF_MONTH, 31); //设置日期为31号
  System.out.println(dateformat.format(calendar.getTime())); //2014年10月01日 00时00分00秒 说明Calendar 对象有容错性
 
  //add() 的功能非常强大,add 可以对 Calendar 的字段进行计算。如果需要减去值,那么使用负数值就可以了;
  //当被修改的字段超出它可以的范围时,那么比它大的字段会自动修正
  calendar.set(2014, 7, 31, 0, 0 , 0); //2000-8-31
  calendar.add(Calendar.MONTH, 1); //2000-9-31 => 2000-10-1,对吗? //add()非常实用,月份加减用
  System.out.println(dateformat.format(calendar.getTime())); //结果是 2000-9-30
 }

0 0
原创粉丝点击