- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to get the day of the week from GregorianCalendar
For GregorianCalendar class, import the following package.
import java.util.GregorianCalendar;
Create an object.
GregorianCalendar calendar = new GregorianCalendar();
To get the day of the week, use the following field.
GregorianCalendar.DAY_OF_WEEK
The following is an example.
Example
import java.util.Calendar; import java.util.GregorianCalendar; public class Demo { public static void main(String[] a) { GregorianCalendar calendar = new GregorianCalendar(); System.out.println("Day of Week = " + calendar.get(GregorianCalendar.DAY_OF_WEEK)); System.out.println("Date = " + calendar.get(GregorianCalendar.DATE)); System.out.println("Month = " + calendar.get(GregorianCalendar.MONTH)); System.out.println("Year = " + calendar.get(GregorianCalendar.YEAR)); } }
Output
Day of Week = 2 Date = 19 Month = 10 Year = 2018
- Related Articles
- Java Program to get day of week as string
- Java Program to get day of week for the last day of each month in 2019
- Get the Day of the Week from Today's Date in Java
- C# Program to get current day of week
- Get Day Number of Week in Java
- Python Pandas - Get the day of the week from the PeriodIndex object
- Java Program to get display name for Day of Week in different locale
- Get the week number in MySQL for day of week?
- Get the day of week for a particular date in Java
- How to get the day of the week in JavaScript?
- How to get first day of the week using Python?
- Java Program to display previous year from GregorianCalendar
- Java Program to display past date from GregorianCalendar
- Java Program to display previous month from GregorianCalendar
- Java Program to get the beginning and end date of the week

Advertisements