前者是在lang包中的,SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. It allows for formatting (date -> text), parsing (text -> date), and normalization. 后者是在util,是Date吧, The class Date represents a specific instant in time, with millisecond precision 前者是对日期的解析,具体看API就知道了
前者是在lang包中的,SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. It allows for formatting (date -> text), parsing (text -> date), and normalization. 后者是在util,是Date吧, The class Date represents a specific instant in time, with millisecond precision 前者是对日期的解析,具体看API就知道了
String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); Date date = new SimpleDateFormat("yyyy-MM-dd").parse(str);这应该是他们之间的联系了,他们根本就没有共同点,谈不上区别
The class Date represents a specific instant in time, with millisecond precision
前者是对日期的解析,具体看API就知道了
The class Date represents a specific instant in time, with millisecond precision
前者是对日期的解析,具体看API就知道了
Date date = new SimpleDateFormat("yyyy-MM-dd").parse(str);这应该是他们之间的联系了,他们根本就没有共同点,谈不上区别
Date 内容