get Current Weekends - Java java.util

Java examples for java.util:Week

Description

get Current Weekends

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getCurrentWeekends());
    }/*from w  w  w. ja v  a  2 s .c o  m*/

    public static Calendar getCurrentWeekends() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek());
        calendar.add(Calendar.DAY_OF_MONTH, -2);
        return calendar;
    }
}

Related Tutorials