Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

get the date of next Monday  RSS feed

 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Abdul Aatif
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!