Be a Knowm.org sponsor

Please contact us or leave a comment if you would like to sponsor this page.

Java_LogoTo get the day of the week from a java.util.Date object, we can use the java.text.SimpleDateFormat class. First, create a Date object. Next, create a SimpleDateFormat instance using the getDateInstance() method, passing the String “E” or “EEEE” as the argument. Get the day of the week as a String using the format() method passing in the java.util.Date object. To get the weekday in numerical format, we can use the java.util.Calendar object’s get method passing in Calendar.DAY_OF_WEEK.

Get Day of Week from Date in Java – Example Code

Here is the output of the example code for getting the day of the week:

Are you interested in the cutting edge of AI processors? Read how to build the Ex-Machina Wetware Brain and learn about the Knowm Technology Stack.

Knowm Sundial Job Scheduling

Knowm Yank JDBC Persistance

Related Posts

4 Comments

  • ravi

    what if we have to provide our specific date i.e,without taking current date i want to give some random date like 08 05 2015

  • ujjwal pandey

    Everything is good but I want to make a program in which I would enter a date(dd/mm/yyyy) of any time and get the day of that date.
    Please provide me the program solution for it please and help me by mailing when posted.
    Ujjwal Pandey.

    • Alex Nugent

      Please see comment in response to ravi. Solution is here.

Leave a Reply to Alex Nugent Cancel reply

Knowm 32X32 Crossbar

Knowm Newsletter

Are you ready for memristor AI processors? With our newsletter, you will be.