Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getNowDate() { StringBuffer sbBuffer = new StringBuffer(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sbBuffer.append(format.format(Calendar.getInstance().getTime())); return sbBuffer.toString(); } }