java 格式化date

Date stringToDate(String dateString) {
        Date dt = null;
        new String();
        if (dateString.contains("T")) {
            String codDateStr = dateString.replace("T", " ");
            if (codDateStr.contains("+")) {
                codDateStr = codDateStr.substring(0, codDateStr.indexOf("+"));
            }

            SimpleDateFormat[] sdfs = new SimpleDateFormat[]{new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"), new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ"), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"), new SimpleDateFormat("yyyy-MM-dd")};
            SimpleDateFormat[] arr$ = sdfs;
            int len$ = sdfs.length;
            int i$ = 0;

            while(i$ < len$) {
                SimpleDateFormat sdf = arr$[i$];

                try {
                    dt = sdf.parse(codDateStr);
                    break;
                } catch (Exception var10) {
                    ++i$;
                }
            }
        }

        return dt;
    }
public String getCreateDate() {   #get回原始
  return this.createDate;
}
public Date findCreateDate() { # find经转化  妙
    return this.stringToDate(this.createDate);
}
价格计算
this.totalPrice = BigDecimal.ZERO;
        this.totalRePrice = BigDecimal.ZERO;
        this.totalDiscount = BigDecimal.ZERO;
        int len$;
        int i$;
        if (this.theSkus != null && this.theSkus.length > 0) {
            SKU[] arr$ = this.theSkus;
            len$ = arr$.length;

            for(i$ = 0; i$ < len$; ++i$) {
                SKU sku = arr$[i$];
                this.totalPrice = this.totalPrice.add(sku.getPrice().multiply(new BigDecimal(sku.getNum())));
                this.totalRePrice = this.totalRePrice.add(sku.getReprice().multiply(new BigDecimal(sku.getNum())));
                this.totalDiscount = this.totalDiscount.add(sku.getDiscount().multiply(new BigDecimal(sku.getNum())));
            }
        }


拷贝属性
org.springframework.beans.BeanUtils
this.foreach(new CartHandler() {
            public void execute(Suit suit, SkuType skuType, SKU sku) {
                SKU e = new SKU();
                if (suit != null) {
                    ;
                }

                BeanUtils.copyProperties(sku, e);
                result.add(e);
            }
        });

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值