Mega Code Archive

 
Categories / Java Tutorial / Development
 

Formatting day of week using SimpleDateFormat

//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));   } }