对Java基础类的Date和Calendar类有些生疏了,使用的时候还是现查的javadoc。
随手记下来吧。

起飞前一天12点前申请退票,按客规走,前一天12点到起飞收50%手续费,起飞后收100%费用  

            DateFormat df = DateFormat.getDateInstance();
            Calendar applyCl 
= Calendar.getInstance();   //申请时间
            Calendar takeoffCl = Calendar.getInstance(); //起飞时间

            Calendar baseCl 
= Calendar.getInstance();    //前一天中午12点

            applyCl.setTime(df.parse(applyTime));
            takeoffCl.setTime(df.parse(takeoffTime));

            
//起飞时间前一天中午12点
            baseCl.setTime(df.parse(takeoffTime));                                
            baseCl.add(Calendar.DATE, 
-1);
            baseCl.set(Calendar.HOUR, 
12);
            baseCl.set(Calendar.MINUTE, 
0);
            baseCl.set(Calendar.SECOND,
0);
        
            Date date 
= baseCl.getTime();
            
//自愿团体起飞前一天12点前退,按客规走,前一天12点到起飞
            
//收50%手续费,起飞后收100%费用                
            if(applyCl.before(baseCl)) {
                feeRate 
= calFeeRate(airCLStr);
            }
else if(applyCl.before(takeoffCl)) {
                feeRate 
= new Integer(50);
            }
else {
                feeRate 
= new Integer(100);
            }                                                            
posted on 2006-09-06 11:02 knowhow 阅读(210) 评论(0)  编辑  收藏 所属分类: Java基础知识