Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    /**
     * Parse a date to string of format HH:mm
     * @param date
     * @return
     */
    public static String date2HHmm(java.util.Date date) {
        if (date == null)
            return null;
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        String result = sdf.format(date);
        return result;
    }
}