Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void test() {
- Stirng t1 = "10:30 AM"; // 12-hours format
- Stirng t2 = "11:30 AM"; // 12-hours format
- <or>
- Stirng t1 = "10:30"; // 24-hours format
- Stirng t2 = "11:30"; // 24-hours format
- if(t1.before(t2)) {
- System.out.println(t1 + " is before of " + t2);
- }
- }
- SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
- Date time = formatter.parse("11:30");
- if (new DateTime(2012, 9, 15, 10, 30).compareTo(new DateTime(2012, 9, 15, 11, 30) < 0) {
- // first is before second date
- }
- if (new LocalTime(10, 30).compareTo(new LocalTime(11, 30) < 0) {
- // first time is before second time
- }
Add Comment
Please, Sign In to add comment