Buggy code:
public class CalendarViewAdapter extends BaseAdapter { private static final String TAG = "MenuSpinnerAdapter" ; private final String [ ] mButtonNames ; private int mCurrentMainView ; private final LayoutInflater mInflater ; private static final int BUTTON_VIEW_TYPE = 0 ; static final int VIEW_TYPE_NUM = 1 ; public static final int DAY_BUTTON_INDEX = 0 ; public static final int WEEK_BUTTON_INDEX = 1 ; public static final int MONTH_BUTTON_INDEX = 2 ; public static final int AGENDA_BUTTON_INDEX = 3 ; private long mMilliTime ; private String mTimeZone ; private long mTodayJulianDay ; private final Context mContext ; private final Formatter mFormatter ; private final StringBuilder mStringBuilder ; private Handler mMidnightHandler = null ; private final boolean mShowDate ; private HashMap < String , String > mLunarInfoMap = new HashMap < String , String > ( ) ; private LunarServiceConnListener mLunarServiceConnListener = new LunarServiceConnListener ( ) { @ Override public void onLunarServiceDisconnected ( ) { } @ Override public void onLunarServiceConnected ( ILunarService service ) { } } ; private final Runnable mTimeUpdater = new Runnable ( ) { @ Override public void run ( ) { } } ; public CalendarViewAdapter ( Context context , int viewType , boolean showDate ) { } public void refresh ( Context context ) { } private void setMidnightHandler ( ) { } public void onPause ( ) { } @ Override public int getCount ( ) { } @ Override public Object getItem ( int position ) { } @ Override public long getItemId ( int position ) { } @ Override public boolean hasStableIds ( ) { } @ Override public View getView ( int position , View convertView , ViewGroup parent ) { } @ Override public int getItemViewType ( int position ) { } @ Override public int getViewTypeCount ( ) { } @ Override public boolean isEmpty ( ) { } @ Override public View getDropDownView ( int position , View convertView , ViewGroup parent ) { } public void setMainView ( int viewType ) { } public void setTime ( long time ) { } private String buildDayOfWeek ( ) { } private String buildFullDate ( ) { } private String buildMonthYearDate ( ) { } private String buildMonthDayDate ( ) { } private String buildMonthDate ( ) { } private String buildWeekDate ( ) { Time t = new Time ( mTimeZone ) ; t . set ( mMilliTime ) ; int firstDayOfWeek = Utils . getFirstDayOfWeek ( mContext ) ; int dayOfWeek = t . weekDay ; int diff = dayOfWeek - firstDayOfWeek ; if ( diff != 0 ) { if ( diff < 0 ) { diff += 7 ; } t . monthDay -= diff ; t . normalize ( true ) ; } long weekStartTime = t . toMillis ( true ) ; long weekEndTime = ( weekStartTime + ( DateUtils . WEEK_IN_MILLIS ) ) - ( DateUtils . DAY_IN_MILLIS ) ; Time t1 = new Time ( mTimeZone ) ; <START_BUG> t . set ( weekEndTime ) ; <END_BUG> int flags = ( DateUtils . FORMAT_SHOW_DATE ) | ( DateUtils . FORMAT_NO_YEAR ) ; if ( ( t . month ) != ( t1 . month ) ) { flags |= DateUtils . FORMAT_ABBREV_MONTH ; } mStringBuilder . setLength ( 0 ) ; String date = DateUtils . formatDateRange ( mContext , mFormatter , weekStartTime , weekEndTime , flags , mTimeZone ) . toString ( ) ; return date ; } private String buildWeekNum ( ) { } private void buildLunarInfo ( ) { } }

Fix:
t1 . set ( weekEndTime ) ;