Java tutorial
//package com.java2s; import java.sql.Date; import java.text.SimpleDateFormat; public class Main { public static String getCurrentTime() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date = new Date(System.currentTimeMillis()); return sdf.format(date); } }