Java - Write code to get Now Time in hh:mm format

Requirements

Write code to get Now Time in hh:mm format

Demo

//package com.book2s;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static void main(String[] argv) {
        System.out.println(getNowTime());
    }/* w w w  .  j  av  a2 s .com*/

    public static String getNowTime() {
        SimpleDateFormat format = new SimpleDateFormat("hh:mm");
        return format.format(new Date());
    }
}

Related Exercise