按一天中的时间过滤日期(初学者)

Filtering dates by time of day (beginner)

我需要编写一个方法,如果给定日期在上午 8 点到下午 5 点之间,则 returns 为真,否则为假。我将如何实施?非常感谢!

public static boolean isInWorkingHours(String date){


}

使用 SimpleDateFormat 解析日期参数,然后将生成的 Date 对象设置为 GregorianCalendar 实例的时间 属性。使用日历的 get() 方法检索一天中的小时数。

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