在Java中获取日期格式 [英] Getting the Date format in Java
本文介绍了在Java中获取日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从日期中有这个
String
对象: Mon Mar 25 00: 00:00 IST 2013
日期格式的 String
表示是什么?
What is the String
representation of the date format?
推荐答案
下面的代码可以正常运行。
The code below should work fine.
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);
}
阅读 javadoc 的有效模式。
这篇关于在Java中获取日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文