Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.FieldPosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {

    public static void main(String args[]) {
        int days = 1;
        int month = 1;
        int year = 2001;
        SimpleDateFormat sdf = new SimpleDateFormat("E dd-MM-yyyy G");
        StringBuffer buf = new StringBuffer();
        Calendar cal = new GregorianCalendar();
        cal.set(year, month - 1, days);
        sdf.format(cal.getTime(), buf, new FieldPosition(10));
        System.out.println(buf.toString());
    }
}