3、其他类API-----练习1:将毫秒值转成 指定的日期的格式

将毫秒值转成 指定的日期的格式   xxxx年xx月xx日   hh:mm:ss
                    步骤:
                    //1,毫秒值time--->Date
                    Date date = new Date(time);
                    //2,通过日期时间格式器对象DateFormat对日期对象进行格式化(日期--->文本字符串)
                    DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG);
                    String str_time = format.format(date);
                    System.out.println(str_time);

 

posted @ 2018-01-29 16:48  清风拂柳  阅读(305)  评论(0编辑  收藏  举报