Code example for GregorianCalendar

Methods: addgetTimeInMillissetTimesetTimeInMillis

		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		return sdf.format(new Date());
	public static Date add24HtoDate(Date date) {
		Calendar cal = new GregorianCalendar();
		cal.setTimeInMillis(date.getTime());// sumamos 24h a la fecha del login
		cal.add(Calendar.DATE, 1);
		return new Date(cal.getTimeInMillis());
	public static Date toDate(String dateStr) {
		Date now = null;
		try { 
			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
			now = sdf.parse(dateStr);
		} catch (ParseException e) {
Connect your IDE to all the code out there  Get Codota for Java