Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.util.Date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static String parseDateToLongForm(String origDate) {
        DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
        Date date;
        String newDate = "";
        try {
            date = formatter.parse(origDate);
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            newDate = String.format("%1$tA, %1$tb %1$td, %1$tY", cal);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return newDate;
    }
}