-
-
Save ar-android/aea01748f3c5f6df325b443067bf68ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WEEK | |
Calendar first = Calendar.getInstance(); | |
first.add(Calendar.DAY_OF_WEEK, first.getFirstDayOfWeek() - first.get(Calendar.DAY_OF_WEEK)); | |
int startWeek = first.get(Calendar.DATE); | |
int endWeek = startWeek + 6; | |
// MONTH | |
// start = 1 | |
Calendar date = Calendar.getInstance(); | |
date.set(Calendar.DAY_OF_MONTH, first.getActualMaximum(Calendar.DAY_OF_MONTH)); | |
int endMonth = first.get(Calendar.DAY_OF_MONTH); | |
// format 2 digit | |
sample: String.format("%02d", first.get(Calendar.DAY_OF_MONTH)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment