Created
November 6, 2014 08:05
-
-
Save vuhung3990/b0bb31369d2931e06da4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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