Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

public class Main {

    public static String parseDateToStr(Date date, String fmt) {
        DateFormat dateFormat = new SimpleDateFormat(fmt, Locale.SIMPLIFIED_CHINESE);
        return dateFormat.format(date);
    }

    public static String parseDateToStr(String fmt) {
        return parseDateToStr(new Date(), fmt);
    }
}