Code example for Timestamp

Methods: getTime

0
 
	public static String getCookie() {
		String cookie = Cookies.getCookie("persistentSessionID");
	    if(cookie==null){
	        Date today = new Date();
	        Timestamp ts = new Timestamp(today.getTime());
	        long tsTime = ts.getTime();
	    	String timestamp = Long.toString(tsTime);
	    	int random = ((int) Math.random() * 1000);
	    	cookie = timestamp+random;
	    	Cookies.setCookie("persistentSessionID",cookie,null);	
	    } 
	    return cookie;
	} 
}