Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**
     * Wrapper for SimpleDateFormat("yyyy-MM-dd HH:mm:ss").
     * ie. "2014-05-31 19:59:08"
     *
     * @param date
     * @return "yyyy-MM-dd HH:mm:ss"
     */
    public static String date2str(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(date);
    }
}