Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getCurrentDate() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Calendar cal = Calendar.getInstance(); return dateFormat.format(cal.getTime()); } }