Is there a date format to display the day of the week in java?

后端 未结 6 1584
执笔经年
执笔经年 2020-12-02 07:40

I know of date formats such as
\"yyyy-mm-dd\" -which displays date in format 2011-02-26
\"yyyy-MMM-dd\"-which displays date

6条回答
  •  误落风尘
    2020-12-02 08:32

    Yep - 'E' does the trick

    http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

    Date date = new Date();
    DateFormat df = new SimpleDateFormat("yyyy-MM-E");
    System.out.println(df.format(date));
    

提交回复
热议问题