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 getDateForFile() {
        Calendar currentTime = Calendar.getInstance();
        int month = currentTime.get(2);
        int date = currentTime.get(5);
        int year = currentTime.get(1);
        int hour = currentTime.get(11);
        int minute = currentTime.get(12);
        int second = currentTime.get(13);
        String result = year + "." + month + "." + date + "/" + hour + ":" + minute + ":" + second;
        return result;
    }
}