Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    public static String getDateTime() {
        String paramFormat = "yyyy-MM-dd";
        SimpleDateFormat sdf = new SimpleDateFormat(paramFormat);
        return sdf.format(System.currentTimeMillis()).toString();
    }

    public static String getDateTime(String time) {
        String paramFormat = "yyyy-MM-dd";
        SimpleDateFormat sdf = new SimpleDateFormat(paramFormat);
        return sdf.format(time).toString();
    }
}