Java Calendar Calculate calculateMinimalDaysInFirstWeek(Calendar calendar)

Here you can find the source of calculateMinimalDaysInFirstWeek(Calendar calendar)

Description

calculate Minimal Days In First Week

License

Open Source License

Declaration

public static int calculateMinimalDaysInFirstWeek(Calendar calendar) 

Method Source Code


//package com.java2s;
/*//  w  ww  .jav  a  2 s.c  om
 * Copyright 2009 Yodlee, Inc.  All Rights Reserved.  Your use of this code 
 * requires a license from Yodlee.  Any such license to this code is 
 * restricted to evaluation/illustrative purposes only. It is not intended 
 * for use in a production environment, and Yodlee disclaims all warranties 
 * and/or support obligations concerning this code, regardless of the terms 
 * of any other agreements between Yodlee and you."
 */

import java.util.Calendar;

public class Main {
    public static int calculateMinimalDaysInFirstWeek(Calendar calendar) {

        Calendar temp = (Calendar) calendar.clone();
        temp.set(Calendar.DAY_OF_YEAR, 1);
        int firstDayOfJan = temp.get(Calendar.DAY_OF_WEEK);
        return 8 - firstDayOfJan;
    }
}

Related

  1. calcDifferenceAsYearsPrivate(Calendar aBaseDate, Calendar aTargetDate)
  2. calcTime(Date end, Date start, int calendarField)
  3. calcTimezone(Calendar cal)
  4. calculateDuration(Calendar para_c1, Calendar para_c2)
  5. calculateHourDiff(Calendar cal1, Calendar cal2)
  6. calculateMonthsInBetween(Calendar startPoint, Calendar endPoint)
  7. calculateRangeInDays(Calendar start, Calendar end)
  8. calculateWeeksInBetween(Calendar startPoint, Calendar endPoint)
  9. calDateOnly(Calendar iniCal)