Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.Calendar;

public class Main {
    public static String getCurrent() {

        Calendar calender = Calendar.getInstance();

        String minute = "";
        if (calender.get(Calendar.MINUTE) < 10) {
            minute = 0 + "" + calender.get(Calendar.MINUTE);
        } else {
            minute = "" + calender.get(Calendar.MINUTE);
        }

        String created = calender.get(Calendar.YEAR) % 100 + "/" + (calender.get(Calendar.MONTH) + 1) + "/"
                + calender.get(Calendar.DAY_OF_MONTH) + " " + calender.get(Calendar.HOUR_OF_DAY) + ":" + minute
                + "";
        return created;
    }
}