Java tutorial
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Main { public static String getYear_Second2() { java.util.Date date1 = new java.util.Date(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String timeStr2 = df.format(date1); return timeStr2; } }