Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Calendar getSpnCal(){
- //getting spn cal date for stamp use
- Calendar cal = Calendar.getInstance();
- int index = spnArr.get(0).getSelectedItemPosition();
- //adjusts week_of_year to actual week_of_year
- cal.set(Calendar.WEEK_OF_YEAR, index + firstWeek + 1);
- cal.getTime();
- index = spnArr.get(1).getSelectedItemPosition();
- //adjusts spinner index to DAY_OF_WEEK index
- cal.set(Calendar.DAY_OF_WEEK, index + 1);
- cal.getTime();
- index = spnArr.get(2).getSelectedItemPosition()+1;
- cal.set(Calendar.HOUR_OF_DAY, index);
- cal.getTime();
- //^^sometimes this just doesn't work
- index = spnArr.get(4).getSelectedItemPosition();
- cal.set(Calendar.AM_PM, index);
- cal.getTime();
- //^^^^sometimes this changes the hour
- index = spnArr.get(3).getSelectedItemPosition();
- cal.set(Calendar.MINUTE, index);
- cal.getTime();
- //only care about whole minutes and extra seconds can throw off calculations
- cal.set(Calendar.SECOND, 0);
- cal.getTime();
- return cal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement