首页>技术文章>Java中使用SimpleDateFormat输出英文日期(原创)

如果你想输出英文日期,形如:
September 29, 2013

可以借助java.text.SimpleDateFormat,使用如下代码:

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public Class PrintEnDateFormat {
public static void main(String args[]) {
Date date = new Date();
DateFormat df = new SimpleDateFormat(“MMMMM dd, yyyy”, Locale.ENGLISH);
String time = df.format(date);
System.out.println(time);
}
}

此时输出结果为:
September 29, 2013

注意:如果不使用Locale.ENGLISH,则输出的结果为:
九月 29, 2013

本文地址:http://www.caihonger.com/tech29/



请写下您的评论