Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static void main(String[] args) throws Exception {
        String source = new String("03/20/2015");
        SimpleDateFormat sdfinput = new SimpleDateFormat("MM/dd/yyyy");
        SimpleDateFormat sdfoutput = new SimpleDateFormat("yyyy-MM-dd");
        Date inputdate = sdfinput.parse(source);
        String outputDate = sdfoutput.format(inputdate);
        System.out.println(outputDate);
    }
}