Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.*;

public class Main {

    public static String weekDay(String year, String month, String day) {
        String strWeekday = "";
        try {
            GregorianCalendar cal = new GregorianCalendar();
            cal.setLenient(false);
            cal.clear();
            cal.set(Integer.parseInt(year), Integer.parseInt(month) - 1, Integer.parseInt(day));
            strWeekday = String.valueOf(cal.get(Calendar.DAY_OF_WEEK) - 1);
        } catch (IllegalArgumentException e) {
            strWeekday = "";
        }
        return strWeekday;
    }
}