67,549
社区成员




private void testDate() {
DateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
try {
Calendar calendar = Calendar.getInstance();
calendar.setTime(simpleDateFormat.parse("2011-1-1"));
System.out.println(calendar.getTime());
System.out.println(simpleDateFormat.format(calendar.getTime()));
} catch (Exception e) {
e.printStackTrace();
}
}
private void testDate() {
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
calendar.setTime(simpleDateFormat.parse("2011-1-1"));
System.out.println(calendar.getTime());
simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
System.out.println(simpleDateFormat.format(calendar.getTime()));
} catch (Exception e) {
e.printStackTrace();
}
}
private static void testDate() {
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
calendar.setTime(simpleDateFormat.parse("2011-1-1"));
System.out.println(calendar.getTime());
System.out.println(simpleDateFormat.format(calendar.getTime()));
} catch (Exception e) {
e.printStackTrace();
}
}
public String toString() {
// NOTE: BuddhistCalendar.toString() interprets the string
// produced by this method so that the Gregorian year number
// is substituted by its B.E. year value. It relies on
// "...,YEAR=<year>,..." or "...,YEAR=?,...".
StringBuilder buffer = new StringBuilder(800);
buffer.append(getClass().getName()).append('[');
appendValue(buffer, "time", isTimeSet, time);
buffer.append(",areFieldsSet=").append(areFieldsSet);
buffer.append(",areAllFieldsSet=").append(areAllFieldsSet);
buffer.append(",lenient=").append(lenient);
buffer.append(",zone=").append(zone);
appendValue(buffer, ",firstDayOfWeek", true, (long) firstDayOfWeek);
appendValue(buffer, ",minimalDaysInFirstWeek", true, (long) minimalDaysInFirstWeek);
for (int i = 0; i < FIELD_COUNT; ++i) {
buffer.append(',');
appendValue(buffer, FIELD_NAME[i], isSet(i), (long) fields[i]);
}
buffer.append(']');
return buffer.toString();
}
private void testDate() {
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
calendar.setTime(simpleDateFormat.parse("2011-1-1"));
System.out.println(calendar.getTime());
System.out.println(simpleDateFormat.format(calendar.getTime(),"yyyyMMdd"));
} catch (Exception e) {
e.printStackTrace();
}
}