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 toYYYYMMDDHHMMSS(Calendar source) {
        if (source == null) {
            return "Can't toYYYYMMDDHHMMSS source null";
        }
        int YYYY = source.get(Calendar.YEAR);
        int MM = source.get(Calendar.MONTH);
        int DD = source.get(Calendar.DAY_OF_MONTH);
        int HH = source.get(Calendar.HOUR_OF_DAY);
        int mm = source.get(Calendar.MINUTE);
        int SS = source.get(Calendar.SECOND);

        return YYYY + "-" + MM + "-" + DD + " " + HH + ":" + mm + ":" + SS;
    }
}