Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Calendar;

import java.util.TimeZone;

public class Main {
    public static String getWochentagFromSystemDate() {
        Calendar rightNow = Calendar.getInstance(TimeZone.getDefault());
        int dayOfWeek = rightNow.get(Calendar.DAY_OF_WEEK);
        switch (dayOfWeek) {
        case 1:
            return "Sonntag";
        case 2:
            return "Montag";
        case 3:
            return "Dienstag";
        case 4:
            return "Mittwoch";
        case 5:
            return "Donnerstag";
        case 6:
            return "Freitag";
        case 7:
            return "Samstag";
        }
        return "";

    }
}