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.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Main {
    public static String formatDate(String date, String format) {
        // "ddd MM, yyyy"

        DateFormat sdf = new SimpleDateFormat(format, Locale.getDefault());
        Date parsedDate = new Date();

        try {
            parsedDate = sdf.parse(date);
            parsedDate.toString();
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return "";
    }
}