import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.util.Locale;

public class DateFormatDemo {
    public static void main(String[] args) {
        BySimpleDateFormat();
    }

    public static void BySimpleDateFormat() {
        // see http://developer.android.com/reference/java/text/SimpleDateFormat.html
        String format = new String("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
        System.out.println(sdf.format(new Date()));

        Calendar cal = Calendar.getInstance();
        System.out.println(sdf.format(cal.getTime()));
    }
}

@@ -633,16 +633,1475 @@
 ime()));
+%0A%0A        // Month and day string%0A        System.out.println(getMonthAndDay(cal));%0A%0A        // %0A%09%09Calendar base = Calendar.getInstance();%0A        // %E8%B6%A8%CE%AA%C4%B3%0A        base.set(2015, 3 - 1, 1);  // %C2%B7%DD%B40%CA%BC3%D2%AA%D0%B42%0A%09%09int min = base.getActualMinimum(Calendar.DAY_OF_WEEK); // %C8%A1%DC%BF%CA%BC%D7%BC%0A%09%09int current = base.get(Calendar.DAY_OF_WEEK); // %C8%A1%DA%B1%0A%0A        // %0A%09%09Calendar thisWeekStart = (Calendar)base.clone();%0A%09%09thisWeekStart.add(Calendar.DAY_OF_WEEK, (current == min) ? -6 : (min - current + 1));%09// %DC%BF%CA%BC%0A%09%09%0A%09%09Calendar thisWeekEnd = (Calendar)base.clone();%0A%09%09thisWeekEnd.add(Calendar.DAY_OF_WEEK, (current == min) ? 0 : (7 - current + 1));%09%09// %DC%BD%0A%0A        // %0A%09%09Calendar nextWeekStart = (Calendar)base.clone();%0A%09%09nextWeekStart.add(Calendar.DAY_OF_WEEK, ((current == min) ? -6 : (min - current + 1)) + 7);%09// %DC%BF%CA%BC%0A%09%09%0A%09%09Calendar nextWeekEnd = (Calendar)base.clone();%0A%09%09nextWeekEnd.add(Calendar.DAY_OF_WEEK, ((current == min) ? 0 : (7 - current + 1)) + 7);%09%09// %DC%BD%0A%0A        // %0A%09%09Calendar preWeekStart = (Calendar)base.clone();%0A%09%09preWeekStart.add(Calendar.DAY_OF_WEEK, ((current == min) ? -6 : (min - current + 1)) - 7);%09// %DC%BF%CA%BC%0A%09%09%0A%09%09Calendar preWeekEnd = (Calendar)base.clone();%0A%09%09preWeekEnd.add(Calendar.DAY_OF_WEEK, ((current == min) ? 0 : (7 - current + 1)) - 7);%09%09// %DC%BD%0A    %7D%0A    %0A    public static String getMonthAndDay(Calendar cal) %7B%0A        SimpleDateFormat sdf = new SimpleDateFormat(%22MM-dd%22, Locale.US);%0A        String monthAndDay = sdf.format(cal.getTime());%0A        return monthAndDay;
 %0A    %7D%0A%7D

update DateFormatDemo