public static void main(String[] args) {
try {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
calendar.setTime(format.parse("2012-06-30 18:30:12"));
System.out.println("Original = " + format.format(calendar.getTime()));
calendar.add(Calendar.HOUR, 5);
calendar.add(Calendar.MINUTE, 00);
calendar.add(Calendar.SECOND, 0);
System.out.println("Updated = " + format.format(calendar.getTime()));
} catch (Exception e) {
}
}
Calendar calendar = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
calendar.setTime(format.parse("2012-06-30 18:30:12"));
System.out.println("Original = " + format.format(calendar.getTime()));
calendar.add(Calendar.HOUR, 5);
calendar.add(Calendar.MINUTE, 00);
calendar.add(Calendar.SECOND, 0);
System.out.println("Updated = " + format.format(calendar.getTime()));
} catch (Exception e) {
}
No comments:
Post a Comment