Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.ParseException;

import java.util.Date;
import java.util.Locale;

public class Main {
    public static String stringFromDateTime(Date dateTime) throws ParseException {
        String dateTimeString;
        DateFormat dateFormatter;

        dateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.getDefault());
        dateTimeString = dateFormatter.format(dateTime);

        return dateTimeString;
    }
}