Java的SimpleDateFormat浅析
添加时间:2013-7-4 点击量:
Java的SimpleDateFormat浅析
媒介
文章开端前,我们先来看一小段代码,这段代码能正常运行吗?

1 package simpledate;
2
3 import java.text.ParseException;
4 import java.text.SimpleDateFormat;
5 import java.util.Date;
6
7 public class Format {
8
9 public static void main(String[] args) throws ParseException {
10 String date = 2012-12-12 00:00:00;
11 SimpleDateFormat simpleDateFormat = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);
12 Date end = simpleDateFormat.parse(date.trim());
13
14 }
15
16 }
View Code
未完待续...
容易发怒的意思就是: 别人做了蠢事, 然后我们代替他们, 表现出笨蛋的样子。—— 蔡康永
Java的SimpleDateFormat浅析
媒介
文章开端前,我们先来看一小段代码,这段代码能正常运行吗?


1 package simpledate;
2
3 import java.text.ParseException;
4 import java.text.SimpleDateFormat;
5 import java.util.Date;
6
7 public class Format {
8
9 public static void main(String[] args) throws ParseException {
10 String date = 2012-12-12 00:00:00;
11 SimpleDateFormat simpleDateFormat = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);
12 Date end = simpleDateFormat.parse(date.trim());
13
14 }
15
16 }
View Code