Code example for Timestamp

Methods: getTime

0
 
	} 
 
	public boolean canRate(String ID, String type) {
		Calendar calendar = Calendar.getInstance();
		Timestamp currentTimestamp = new java.sql.Timestamp(calendar.getTime()
				.getTime());
 
		String[] result;
		db.open();
		result = db.getByIdAndType(ID, type);
		if (result[2] != null) {
			Timestamp oldTimestamp = Timestamp.valueOf(result[2]);
 
			long diffSeconds = (currentTimestamp.getTime() / 1000)
					- (oldTimestamp.getTime() / 1000);
 
			if (diffSeconds < 604800)
				return false; 
			else 
				return true;