细心!用心!耐心!

吾非文人,乃市井一俗人也,读百卷书,跨江河千里,故申城一游; 一两滴辛酸,三四年学业,五六点粗墨,七八笔买卖,九十道人情。

BlogJava 联系 聚合 管理
  1 Posts :: 196 Stories :: 10 Comments :: 0 Trackbacks
/**
  * 格式化日期1
  * */
    public static String formatTime( Calendar cal, String format ){
        SimpleDateFormat localTimeFormatter
            = new SimpleDateFormat(format);
        return localTimeFormatter.format(cal.getTime());
    }
    /**
  * 格式化日期2
  * */
    public static Calendar formatDate( String time, String format ){
        try{
            Date d = new Date();
            SimpleDateFormat timeFormatter1
                = new SimpleDateFormat(format);
            d = timeFormatter1.parse(time);
            Calendar cal = Calendar.getInstance();
            cal.setTime(d);
            return cal;
        }catch ( Exception ex ){
            log.error("error: ", ex);
            return Calendar.getInstance();
        }
    }
posted on 2007-02-07 10:59 张金鹏 阅读(200) 评论(0)  编辑  收藏 所属分类: core java中的一些数据结构的处理

只有注册用户登录后才能发表评论。


网站导航: