Android examples for java.util:Day
get first Day Of Half Year
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static String getfirstDayOfHalfYear() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);//from w w w. j a v a2 s. co m Calendar cal = Calendar.getInstance(); int month = cal.get(Calendar.MONTH); if (month <= 5) { cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH, 1); } else { cal.set(Calendar.MONTH, Calendar.JULY); cal.set(Calendar.DAY_OF_MONTH, 1); } return format.format(cal.getTime()); } }