- import java.text.DateFormat;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
-
- public class DateTest {
-
-
-
-
- public static void main(String[] args) {
-
- DateFormat df = new SimpleDateFormat("HH:mm:ss");
- try {
- Date dt1 = df.parse("15:00:00");
- Date dt2 = df.parse("17:00:00");
- if(dt1.getTime()>dt2.getTime())
- {
- System.out.println("yes");
- }
- else
- {
- System.out.println("no");
- }
- } catch (ParseException e) {
-
- e.printStackTrace();
- }
-
- }
-
- }
来源:http://lqzit.iteye.com/blog/1103345