Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String getCurrentTime() { Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH) + 1; int day = c.get(Calendar.DAY_OF_MONTH); String time = year + "-" + month + "-" + day; return time; } }