Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import java.util.Date;

public class Main {
    public static String getCurrentTimeString() {
        Date timeDate = new Date(System.currentTimeMillis());
        String min = "" + timeDate.getMinutes();
        if (min.length() < 2) {
            min = "0" + min;
        }
        String h = "" + timeDate.getHours();
        if (h.length() < 2) {
            h = "0" + h;
        }
        return h + ":" + min;
    }
}