Format day of week with E in Java

Description

The following code shows how to format day of week with E.

Example


// w w  w.  j a  va 2 s.c  om
//Formatting day of week in E format like Sun, Mon etc.
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
  public static void main(String[] args) {
    Date date = new Date();
    String strDateFormat = "E";
    SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
    System.out.println("Current day of week in E format : " + sdf.format(date));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Date »




Date Get
Date Set
Date Format
Date Compare
Date Convert
Date Calculation
Date Parse
Timezone