Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;

public class Main {
    /**
     * 
     * @return
     */
    public static String ID_DayName() {
        Calendar cal = Calendar.getInstance();
        int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
        String weekDayName = "";

        if (Calendar.MONDAY == dayOfWeek) {
            weekDayName = "Senin";
        } else if (Calendar.TUESDAY == dayOfWeek) {
            weekDayName = "Selasa";
        } else if (Calendar.WEDNESDAY == dayOfWeek) {
            weekDayName = "Rabu";
        } else if (Calendar.THURSDAY == dayOfWeek) {
            weekDayName = "Kamis";
        } else if (Calendar.FRIDAY == dayOfWeek) {
            weekDayName = "Jumat";
        } else if (Calendar.SATURDAY == dayOfWeek) {
            weekDayName = "Sabtu";
        } else if (Calendar.SUNDAY == dayOfWeek) {
            weekDayName = "Minggu";
        }

        return weekDayName;
    }
}