I understand this is quite an old question. But would like to clarify that:
Date d = new Date()
is depriciated in the current versions of Java. The recommended way is using a calendar object. For eg:
Calendar cal = Calendar.getInstance();
Date currentTime = cal.getTime();
I hope this will help people who may refer this question in future. Thank you all.