How to get day from date in Java using Calendar?

Ads
Ads

How to get day from date in Java using Calendar?


Java Coder
How to get day from date in Java using Calendar?
1 Answer(s)      a year and a month ago
Posted in : Java Beginners
Ads

Hi,

I have a calendar object in my Java program. How I can get the day of date from this?

How to get day from date in Java using Calendar?

Thanks

View Answers

April 16, 2017 at 8:58 PM


Hi, If you don't have calendar object then you should first create it and then you can easily get the day of week from this.

Following program works very well:

int weekday = calendar.get(Calendar.DAY_OF_WEEK);

You can also check this tutorial Find Day of Month for more details.

Thanks


Ads