提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用SimpleDateFormat格式化星期几
import java.text.SimpleDateFormat; import java.util.Date; /* from NowJava.com */ public class Main { public static void main(String[] args) { Date date = new Date(); //formatting day of week in E format like Sun, Mon etc. String strDateFormat = "E"; SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); System.out.println("Current day of week in E format : " + sdf.format(date)); //formatting day of week in EEEE format like Sunday, Monday etc. strDateFormat = "EEEE"; sdf = new