Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static String getHour(long time) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(time);
        int hour = c.get(Calendar.HOUR_OF_DAY);
        int minute = c.get(Calendar.MINUTE);
        String times = "" + hour;
        if (minute < 10) {
            times += ":0" + minute;
        } else {
            times += ":" + minute;
        }
        return times;
    }
}