Created
November 17, 2009 09:44
-
-
Save pcdinh/236790 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
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); | |
java.util.Date date = new java.util.Date(); | |
String today = dateFormat.format(date); | |
Calendar calendar = Calendar.getInstance(); | |
// set the calendar time (here, we set it to "today" / "now" date) | |
calendar.setTime(date); | |
calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); // first day of week. | |
String firstDayInWeek = dateFormat.format(calendar.getTime()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment