Code example for Timestamp

Methods: compareTo

0
	 * compare two sql.Timestamp ,if timestamp1 is earlier return -1,equal 
	 * return 0, later return 1 
	 */ 
	public static int compareTimestamp(Timestamp timestamp1,
			Timestamp timestamp2) {
		int result = timestamp1.compareTo(timestamp2);
		return result;
	} 
 
	/** 
	 *  向前或者向后推多少天 
	 * @param date 当前日期的 str格式 
	 * @param len  要推的天数 
	 * @return 返回目标日期 
	 */ 
	public static String dayMove(String date, int len) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		try { 
			Calendar cal = Calendar.getInstance();
			cal.setTime(sdf.parse(date));
			cal.add(Calendar.DATE, len);