Java tutorial
//package com.java2s; import java.sql.Timestamp; import java.text.SimpleDateFormat; public class Main { public static String getYYYY_MM_dd() { Timestamp ts = new Timestamp(System.currentTimeMillis()); long timestamp = ts.getTime(); SimpleDateFormat formater = new SimpleDateFormat("yyyy.MM.dd hh:mm:ss"); String strTime = formater.format(timestamp); return strTime; } }