Ash*_*shu 0 java date simpledateformat
我String
从一个Date
对象得到这个:Mon Mar 25 00:00:00 IST 2013
String
日期格式的表示是什么?
下面的代码应该可以正常工作.
public static void main(String[] args) throws Exception {
String target = "Mon Mar 25 00:00:00 IST 2013";
DateFormat df = new SimpleDateFormat("EEE MMM dd kk:mm:ss z yyyy", Locale.ENGLISH);
Date result = df.parse(target);
System.out.println(result);
}
Run Code Online (Sandbox Code Playgroud)
阅读有效模式的javadoc.