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;

import java.util.Locale;

public class Main {

    public static String getDateString(Date value, String format) {
        String result = null;
        if (null != value) {
            SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.CHINA);

            try {
                result = dateFormat.format(value);
            } catch (Exception e) {

                e.printStackTrace();
            }
        }
        return result;
    }
}