Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static String getCurrentDate() { Calendar cal = Calendar.getInstance(Locale.ENGLISH); SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String txtcurrentDate = dateFormat1.format(cal.getTime()); return txtcurrentDate; } }