Java beginner here. After googling and researching, this is the best way I found in my opinion to generate the current date/time:
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
- How do I place the above current date/time into a variable?
- How do I generate a RANDOM future date from current date/time (for example, the random range can be from 5 - 10 days), this means I do not have a fixed date for the future date.
- How do I store that future date into a variable?
SIDE NOTE: Why I asked Question 1 and 3, it's because I can use the variables storing both dates for comparison and evaluation purposes (used in if-else blocks)
Thanks a lot for your help!
Aucun commentaire:
Enregistrer un commentaire