File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes get the date of next Monday Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "get the date of next Monday" Watch "get the date of next Monday" New topic

get the date of next Monday

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
In Java, is there a way I can get the "date" value of NEXT Monday 9AM ?

For example, if now is Tuesday I want next Monday's 9Am DATE, if now is Monday 9:05AM I still want next Monday's 9AM DATE; if now is 8:55AM MOnday, then it should give me today's 9AM.

I don't see such API. Any help will be appreciated.
Paul Clapham

Joined: Oct 14, 2005
Posts: 18649

There isn't any API that has that exact method built into it. But you could certainly use java.util.Calendar to do the calculation.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19718

For most date/time calculations, java.util.Calendar is your friend.

The last two lines show you how to get a Date object or String from the Calendar.

How To Ask Questions How To Answer Questions
Abdul Aatif

Joined: Feb 08, 2012
Posts: 23
Thank you very much
I agree. Here's the link:
subject: get the date of next Monday