Share on Facebook0Tweet about this on TwitterShare on Reddit0Share on Google+0Share on LinkedIn0Share on StumbleUpon0Buffer this pageEmail this to someonePrint 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:

Share on Facebook0Tweet about this on TwitterShare on Reddit0Share on Google+0Share on LinkedIn0Share on StumbleUpon0Buffer this pageEmail this to someonePrint this page

Related Posts

Subscribe To Our Newsletter

Join our low volume mailing list to receive the latest news and updates from our team.

Leave a Comment

Newsletter

Subscribe to our low-volume mailing list to receive important updates and announcements directly in your inbox.