Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;

public class Main {

    public static List<String> getWeekDate() {
        List<String> list = new ArrayList<String>();
        Calendar calendar = Calendar.getInstance(Locale.CHINA);
        calendar.setTime(new Date());
        calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        list.add(calendar.get(Calendar.MONTH) + 1 + "." + calendar.get(Calendar.DATE));
        for (int i = 0; i < 6; i++) {
            calendar.add(Calendar.DATE, 1);
            String str = calendar.get(Calendar.MONTH) + 1 + "." + calendar.get(Calendar.DATE);
            list.add(str);
        }
        return list;
    }
}