date of the week

<!--?xml version="1.0" encoding="UTF-8" standalone="no"?--> SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");Calendarc = Calendar.getInstance();intweekday = c.get(7) - 1;c.add(5,-weekday);System.out.println("JAVA-API,本周开始时间:"+ sdf.format(c.getTime()));c.add(5,6);System.out.println("JAVA-API,本周开始结束:"+ sdf.format(c.getTime()));Calendarc3 = Calendar.getInstance();intdayofweek = c3.get(Calendar.DAY_OF_WEEK) - 1;if(dayofweek == 0){dayofweek=7;}c3.add(Calendar.DATE,-dayofweek + 1);














System.out.println("Chinese custom, this Monday: " + sdf.format(c3.getTime())); Calendar c2 = Calendar.getInstance(); int dayofweek2 = c2.get(Calendar.DAY_OF_WEEK) - 1 ; if (dayofweek2 == 0){ dayofweek2 = 7; } c2.add(Calendar.DATE, -dayofweek2 + 7); System.out.println("Chinese custom, this Sunday: " + sdf.format(c2. getTime()));







Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326929055&siteId=291194637