How to assign loops with current time? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to assign loops with current time?

In java I want to create a program that can output seperate things depending on time. But don't think that im talking about Random method. it may be like you've input your age and the program will output your date of birth by subtracting your age from the current time. Please help....😊

25th Oct 2017, 10:04 AM
XxSYDxX
XxSYDxX - avatar
1 Answer
0
Try using a Date object. Date objects hold the current moment in time as a String, with everything from year, month, and day, to hour and second, including which time zone you are in. Try playing around with it for a while. Once you have an idea of how to use it, you can then ask for age, and do some math, using the Date object as a reference. I hope this has helped, and that it wasn't rude...
25th Oct 2017, 1:29 PM
Quantallax