MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class MainClass {

    public static void main(String[] args) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
        String date = "2003/01/10";
        java.util.Date utilDate = null;
        try {
            utilDate = formatter.parse(date);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println("date:" + date);
        System.out.println("utilDate:" + utilDate);

    }

}