how to make a method that receives a whole parameter, and calculate the time, and tell me if it is: dawn, morning, day or night | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to make a method that receives a whole parameter, and calculate the time, and tell me if it is: dawn, morning, day or night

10th Oct 2017, 12:43 AM
Anthony
2 Answers
+ 2
what is your whole parameter? could you give an example?
10th Oct 2017, 12:57 AM
Daniel
Daniel - avatar
+ 1
Divide the 24 hours into 4 sections - 0.00 am to 6.00 am (night), 6.00am to 12.00am (morning), 12.00pm - 6.00pm (day), 6.00pm - 0.00am (evening). Perform a string manipulations with current time to make it comparable with those sections and here you go.
10th Oct 2017, 12:50 AM
Freezemage
Freezemage - avatar