Java examples for Date Time:SimpleDateFormat
Formatting day of week using SimpleDateFormat
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] args) { Date date = new Date(); // w w w. j a v a 2 s . c o m //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 SimpleDateFormat(strDateFormat); System.out.println("Current day of week in EEEE format : " + sdf.format(date)); } }