Search code examples
javadatesimpledateformatdayofweek

How to retrieve the current day of the week?


How would I get the current day of the week? Can some please help me?


Solution

  • To get a text display of the day of the week you can use:

    DateFormat dateFormat = new SimpleDateFormat("EEEE");
    System.out.println("Today is " + dateFormat.format(new Date()));
    

    output:

    Today is Sunday