Set Calendar.DAY_OF_WEEK using java.time.DayOfWeek -


currently i've got code sets day_of_week on calendar based on java8 java.time.dayofweek object. since integer values these types misaligned, i.e.

calendar.sunday == 1

where

dayofweek.sunday == 7

i wondering if there recommended way convert 1 other. i'm doing this.

calendar.set(calendar.day_of_week, dayofweek.getvalue() == 7 ? 1 : dayofweek.getvalue() + 1); 

dayofweek enum representing 7 days of week - monday, tuesday, wednesday, thursday, friday, saturday , sunday, followed iso-8601 standard, 1 (monday) 7 (sunday). more info click here

but in calender class given in different way i.e., sunday(1) saturday(7).see here.

the approach following guess.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -