The day of the week can be easily extracted from the date given to us.

The logic behind this program is to create a calendar object and set the calendar entries as per your requirements.
After that we use getWeekdays() method and pass the integer value of days of the week to get the actual day.

The program is as follows.

package com.wordpress.milindjagre;


import java.text.DateFormatSymbols;

import java.text.ParseException;

import java.util.Calendar;

import java.util.Date;

import java.util.GregorianCalendar;


public class ExtractingDayFromDate {


public static final void main(String[] args) throws ParseException {


Calendar cal = GregorianCalendar.getInstance();

cal.set(2014, Calendar.JANUARY, 01);


String dayName = new DateFormatSymbols().getWeekdays()[cal


System.out.println(“date : ” + cal.getTime());

System.out.println(“day  : ” + dayName);











Try is our guys and let me know if something is wrong or if we can improve this logic.

Hope you had a great read. Thank you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: