Monday, March 21, 2011

Date Function in Java

Getting the current Date-time:
public String getCuurentDateTime(){
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
String cal2 = dateFormat.format(cal.getTime());
return cal2;

No comments:

Post a Comment