0

I need to write a method which returns true if a given date is between the hours of 8am and 5pm, and false otherwise. How would I implement this? Thanks a lot!

public static boolean isInWorkingHours(String date){


}
leppie
  • 115,091
  • 17
  • 196
  • 297
user3133300
  • 607
  • 4
  • 13
  • 23

1 Answers1

1

Parse the date parameter with the SimpleDateFormat, then set the resulting Date object as time property of a GregorianCalendar instance. Use calendar's get() method to retrieve the hour of day.

http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html