时间格式化

Posted on 2015-12-25 15:07  小小蜗牛灬  阅读(122)  评论(0)    收藏  举报

1.

 1 public class test {
 2     static String searchText="2015/9/3 0:00:00";
 3     public static void main(String[] args) {
 4         String dateTime="";
 5         SimpleDateFormat format1 = new SimpleDateFormat("yyyy/MM/dd");
 6         SimpleDateFormat format2 = new SimpleDateFormat("yyyy年MM月dd日");
 7         try {
 8             dateTime=format2.format(format1.parse(searchText));
 9 
10         } catch (ParseException e) {
11             // TODO Auto-generated catch block
12             e.printStackTrace();
13         }
14         System.out.println(dateTime);
15     }
16 }

 

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3