Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Main {

    public static void main(String[] args) throws Exception {

        String laDate = "2014-06-15";
        String dateString = laDate.substring(8, 10) + "/" + laDate.substring(5, 7) + "/" + laDate.substring(0, 4);
        Date date = new SimpleDateFormat("dd/MM/yyyy").parse(dateString);
        String dateFormat = "dd-MMM-yyyy";
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, new Locale("en_US"));
        String tDate = sdf.format(date);
        System.out.println(tDate);

    }

}